diff options
author | 卜部昌平 <[email protected]> | 2020-06-15 16:09:33 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-06-29 11:05:41 +0900 |
commit | 41703fcfabee00320f67875d743f4bc002eb65c9 (patch) | |
tree | e38110a70343e0a4d8ade8eee622465f0992f3d8 /marshal.c | |
parent | 6575766ea04ec49a77dad36d4a200fbd7b263d22 (diff) |
r_object0: 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 'marshal.c')
-rw-r--r-- | marshal.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1739,8 +1739,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) } v = r_object0(arg, 0, extmod); if (rb_special_const_p(v) || RB_TYPE_P(v, T_OBJECT) || RB_TYPE_P(v, T_CLASS)) { - format_error: - rb_raise(rb_eArgError, "dump format error (user class)"); + goto format_error; } if (RB_TYPE_P(v, T_MODULE) || !RTEST(rb_class_inherited_p(c, RBASIC(v)->klass))) { VALUE tmp = rb_obj_alloc(c); @@ -1751,6 +1750,9 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) } break; + format_error: + rb_raise(rb_eArgError, "dump format error (user class)"); + case TYPE_NIL: v = Qnil; v = r_leave(v, arg); |