From 1e9d58391c4f6b070d6713270a24181e7ec113a5 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:15:32 +0900 Subject: rb_copy_generic_ivar: 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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'variable.c') diff --git a/variable.c b/variable.c index 144f943618..7477006370 100644 --- a/variable.c +++ b/variable.c @@ -1494,12 +1494,7 @@ rb_copy_generic_ivar(VALUE clone, VALUE obj) rb_check_frozen(clone); if (!FL_TEST(obj, FL_EXIVAR)) { - clear: - if (FL_TEST(clone, FL_EXIVAR)) { - rb_free_generic_ivar(clone); - FL_UNSET(clone, FL_EXIVAR); - } - return; + goto clear; } if (gen_ivtbl_get(obj, &ivtbl)) { struct givar_copy c; @@ -1526,6 +1521,13 @@ rb_copy_generic_ivar(VALUE clone, VALUE obj) */ st_insert(generic_iv_tbl, (st_data_t)clone, (st_data_t)c.ivtbl); } + return; + + clear: + if (FL_TEST(clone, FL_EXIVAR)) { + rb_free_generic_ivar(clone); + FL_UNSET(clone, FL_EXIVAR); + } } void -- cgit v1.2.3