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.
This commit is contained in:
卜部昌平 2020-06-22 10:15:32 +09:00
Родитель fc45a061b9
Коммит 1e9d58391c
1 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -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