зеркало из https://github.com/github/ruby.git
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:
Родитель
fc45a061b9
Коммит
1e9d58391c
14
variable.c
14
variable.c
|
@ -1494,12 +1494,7 @@ rb_copy_generic_ivar(VALUE clone, VALUE obj)
|
||||||
rb_check_frozen(clone);
|
rb_check_frozen(clone);
|
||||||
|
|
||||||
if (!FL_TEST(obj, FL_EXIVAR)) {
|
if (!FL_TEST(obj, FL_EXIVAR)) {
|
||||||
clear:
|
goto clear;
|
||||||
if (FL_TEST(clone, FL_EXIVAR)) {
|
|
||||||
rb_free_generic_ivar(clone);
|
|
||||||
FL_UNSET(clone, FL_EXIVAR);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (gen_ivtbl_get(obj, &ivtbl)) {
|
if (gen_ivtbl_get(obj, &ivtbl)) {
|
||||||
struct givar_copy c;
|
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);
|
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
|
void
|
||||||
|
|
Загрузка…
Ссылка в новой задаче