rb_class_modify_check: 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
a2677815f5
commit
0b1b734515
Notes:
git
2020-06-29 11:07:07 +09:00
3
eval.c
3
eval.c
@ -456,7 +456,6 @@ void
|
||||
rb_class_modify_check(VALUE klass)
|
||||
{
|
||||
if (SPECIAL_CONST_P(klass)) {
|
||||
noclass:
|
||||
Check_Type(klass, T_CLASS);
|
||||
}
|
||||
if (OBJ_FROZEN(klass)) {
|
||||
@ -489,7 +488,7 @@ rb_class_modify_check(VALUE klass)
|
||||
desc = "class";
|
||||
break;
|
||||
default:
|
||||
goto noclass;
|
||||
Check_Type(klass, T_CLASS);
|
||||
}
|
||||
}
|
||||
rb_frozen_error_raise(klass, "can't modify frozen %s: %"PRIsVALUE, desc, klass);
|
||||
|
Loading…
x
Reference in New Issue
Block a user