From b95b249784d51697f9f890d6f2a4fba5be08e342 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, 22 Jun 2020 10:18:28 +0900 Subject: rb_mod_remove_cvar: 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. --- variable.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/variable.c b/variable.c index 7477006370..362ccddc13 100644 --- a/variable.c +++ b/variable.c @@ -3335,9 +3335,7 @@ rb_mod_remove_cvar(VALUE mod, VALUE name) st_data_t val, n = id; if (!id) { - not_defined: - rb_name_err_raise("class variable %1$s not defined for %2$s", - mod, name); + goto not_defined; } rb_check_frozen(mod); if (RCLASS_IV_TBL(mod) && st_delete(RCLASS_IV_TBL(mod), &n, &val)) { @@ -3346,7 +3344,9 @@ rb_mod_remove_cvar(VALUE mod, VALUE name) if (rb_cvar_defined(mod, id)) { rb_name_err_raise("cannot remove %1$s for %2$s", mod, ID2SYM(id)); } - goto not_defined; + not_defined: + rb_name_err_raise("class variable %1$s not defined for %2$s", + mod, name); } VALUE -- cgit v1.2.3