diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-16 10:50:53 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | 3b8d9badab0433e3022c2d423c3f53b00de634d7 (patch) | |
tree | 07e5dd37e0126bf9c4a88f376a09f3a3e86d48ca /object.c | |
parent | 1f6e74106f452057d857e7f935b13b2064cfac98 (diff) |
rb_mod_const_get: 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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3247
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -2504,8 +2504,7 @@ rb_mod_const_get(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] == ':') { @@ -2572,6 +2571,9 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod) } return mod; + + wrong_name: + rb_name_err_raise(wrong_constant_name, mod, name); } /* |