aboutsummaryrefslogtreecommitdiffstats
path: root/object.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-16 10:53:31 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit268962077a84d4d24401986af56992aeb39a8146 (patch)
tree4bcdb1d485f08de5b8f2167819ac8532ef659b05 /object.c
parent60212cd8eef55b1b3c4482dfd0c65d2151cb2d30 (diff)
downloadruby-268962077a84d4d24401986af56992aeb39a8146.tar.gz
rb_mod_const_location: 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 'object.c')
-rw-r--r--object.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/object.c b/object.c
index cec3890721..c0481d75f3 100644
--- a/object.c
+++ b/object.c
@@ -2835,8 +2835,7 @@ rb_mod_const_source_location(int argc, VALUE *argv, VALUE mod)
pend = path + RSTRING_LEN(name);
if (p >= pend || !*p) {
- wrong_name:
- rb_name_err_raise(wrong_constant_name, mod, name);
+ goto wrong_name;
}
if (p + 2 < pend && p[0] == ':' && p[1] == ':') {
@@ -2902,6 +2901,9 @@ rb_mod_const_source_location(int argc, VALUE *argv, VALUE mod)
}
return loc;
+
+ wrong_name:
+ rb_name_err_raise(wrong_constant_name, mod, name);
}
/*