diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-17 16:05:43 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | d49924ed81af7f5f00841ce7b4aa423a924d3af0 (patch) | |
tree | 7004822a3aac93477ff9597119f50be1c1f9d657 /string.c | |
parent | c422fc4bbcb58a16fc84a287baa3cb2d454d7a81 (diff) |
rb_str_match: 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 'string.c')
-rw-r--r-- | string.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -3864,15 +3864,13 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str) static VALUE rb_str_match(VALUE x, VALUE y) { - if (SPECIAL_CONST_P(y)) goto generic; - switch (BUILTIN_TYPE(y)) { + switch (OBJ_BUILTIN_TYPE(y)) { case T_STRING: rb_raise(rb_eTypeError, "type mismatch: String given"); case T_REGEXP: return rb_reg_match(y, x); - generic: default: return rb_funcall(y, idEqTilde, 1, x); } |