aboutsummaryrefslogtreecommitdiffstats
path: root/variable.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-22 10:18:28 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commitb95b249784d51697f9f890d6f2a4fba5be08e342 (patch)
tree2162dbefa60a0353ada93be5f7c56fac8f187e35 /variable.c
parent1e9d58391c4f6b070d6713270a24181e7ec113a5 (diff)
downloadruby-b95b249784d51697f9f890d6f2a4fba5be08e342.tar.gz
rb_mod_remove_cvar: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/variable.c b/variable.c
index 7477006370..362ccddc13 100644
--- a/variable.c
+++ b/variable.c
@@ -3335,9 +3335,7 @@ rb_mod_remove_cvar(VALUE mod, VALUE name)
st_data_t val, n = id;
if (!id) {
- not_defined:
- rb_name_err_raise("class variable %1$s not defined for %2$s",
- mod, name);
+ goto not_defined;
}
rb_check_frozen(mod);
if (RCLASS_IV_TBL(mod) && st_delete(RCLASS_IV_TBL(mod), &n, &val)) {
@@ -3346,7 +3344,9 @@ rb_mod_remove_cvar(VALUE mod, VALUE name)
if (rb_cvar_defined(mod, id)) {
rb_name_err_raise("cannot remove %1$s for %2$s", mod, ID2SYM(id));
}
- goto not_defined;
+ not_defined:
+ rb_name_err_raise("class variable %1$s not defined for %2$s",
+ mod, name);
}
VALUE