From 0b1b73451528d946060f4876aa38fc3278899deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Mon, 15 Jun 2020 11:58:30 +0900 Subject: [PATCH] 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. --- eval.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eval.c b/eval.c index c44bf13ed8..65414d27cc 100644 --- a/eval.c +++ b/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);