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.
This commit is contained in:
parent
31e5d138d7
commit
673ddea934
Notes:
git
2020-06-29 11:06:46 +09:00
4
string.c
4
string.c
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user