iseq_set_exception_table: 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:
parent
a93da4970b
commit
a5342f46e6
Notes:
git
2020-06-29 11:07:13 +09:00
@ -2428,7 +2428,8 @@ iseq_set_exception_table(rb_iseq_t *iseq)
|
|||||||
unsigned int tlen, i;
|
unsigned int tlen, i;
|
||||||
struct iseq_catch_table_entry *entry;
|
struct iseq_catch_table_entry *entry;
|
||||||
|
|
||||||
if (NIL_P(ISEQ_COMPILE_DATA(iseq)->catch_table_ary)) goto no_catch_table;
|
iseq->body->catch_table = NULL;
|
||||||
|
if (NIL_P(ISEQ_COMPILE_DATA(iseq)->catch_table_ary)) return COMPILE_OK;
|
||||||
tlen = (int)RARRAY_LEN(ISEQ_COMPILE_DATA(iseq)->catch_table_ary);
|
tlen = (int)RARRAY_LEN(ISEQ_COMPILE_DATA(iseq)->catch_table_ary);
|
||||||
tptr = RARRAY_CONST_PTR_TRANSIENT(ISEQ_COMPILE_DATA(iseq)->catch_table_ary);
|
tptr = RARRAY_CONST_PTR_TRANSIENT(ISEQ_COMPILE_DATA(iseq)->catch_table_ary);
|
||||||
|
|
||||||
@ -2465,10 +2466,6 @@ iseq_set_exception_table(rb_iseq_t *iseq)
|
|||||||
iseq->body->catch_table = table;
|
iseq->body->catch_table = table;
|
||||||
RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->catch_table_ary, 0); /* free */
|
RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->catch_table_ary, 0); /* free */
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
no_catch_table:
|
|
||||||
iseq->body->catch_table = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return COMPILE_OK;
|
return COMPILE_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user