time_mload: 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-19 12:59:31 +09:00
parent ed6938ef50
commit fd0e935886
Notes: git 2020-06-29 11:06:39 +09:00

6
time.c
View File

@ -5328,8 +5328,7 @@ time_mload(VALUE time, VALUE str)
StringValue(str); StringValue(str);
buf = (unsigned char *)RSTRING_PTR(str); buf = (unsigned char *)RSTRING_PTR(str);
if (RSTRING_LEN(str) < base_dump_size) { if (RSTRING_LEN(str) < base_dump_size) {
invalid_format: goto invalid_format;
rb_raise(rb_eTypeError, "marshaled time format differ");
} }
p = s = 0; p = s = 0;
@ -5432,6 +5431,9 @@ end_submicro: ;
} }
return time; return time;
invalid_format:
rb_raise(rb_eTypeError, "marshaled time format differ");
} }
/* :nodoc: */ /* :nodoc: */