summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-18 15:24:56 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commitfdae2063fb4730c0194e2a312ff250902a23df08 (patch)
tree1bc1f38b0f0bc97300b6a38c11a8e5fdc1660aa8
parent673ddea934db68a074e25925602a32b2994e3b06 (diff)
get_pat_quoted: 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
-rw-r--r--string.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/string.c b/string.c
index dc1df0671d..1a9fd3bca1 100644
--- a/string.c
+++ b/string.c
@@ -5032,8 +5032,7 @@ get_pat_quoted(VALUE pat, int check)
{
VALUE val;
- if (SPECIAL_CONST_P(pat)) goto to_string;
- switch (BUILTIN_TYPE(pat)) {
+ switch (OBJ_BUILTIN_TYPE(pat)) {
case T_REGEXP:
return pat;
@@ -5041,7 +5040,6 @@ get_pat_quoted(VALUE pat, int check)
break;
default:
- to_string:
val = rb_check_string_type(pat);
if (NIL_P(val)) {
Check_Type(pat, T_REGEXP);