1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
卜部昌平 2020-06-16 10:53:31 +09:00
parent 60212cd8ee
commit 268962077a
Notes: git 2020-06-29 11:06:57 +09:00

View file

@ -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);
}
/*