diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-18 15:24:16 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | 673ddea934db68a074e25925602a32b2994e3b06 (patch) | |
tree | 42da00d2c0f5d1ade3fea9c142957a5a86b4120e /string.c | |
parent | 31e5d138d71f186c5ab86b6a13b3b7472a693f80 (diff) | |
download | ruby-673ddea934db68a074e25925602a32b2994e3b06.tar.gz |
get_pat: 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 'string.c')
-rw-r--r-- | string.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -5009,8 +5009,7 @@ get_pat(VALUE pat) { VALUE val; - if (SPECIAL_CONST_P(pat)) goto to_string; - switch (BUILTIN_TYPE(pat)) { + switch (OBJ_BUILTIN_TYPE(pat)) { case T_REGEXP: return pat; @@ -5018,7 +5017,6 @@ get_pat(VALUE pat) break; default: - to_string: val = rb_check_string_type(pat); if (NIL_P(val)) { Check_Type(pat, T_REGEXP); |