diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-11 14:28:21 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | a5342f46e6efc88bd0c0af9d30ba8af7194eb005 (patch) | |
tree | 6eb8fdb3d1a81bfec2644f227d6ba4ddd4a902af /compile.c | |
parent | a93da4970be44a473b7b42e7516eb2663dece2c3 (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3247
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -2428,7 +2428,8 @@ iseq_set_exception_table(rb_iseq_t *iseq) unsigned int tlen, i; 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); 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; 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; } |