summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-19 12:59:31 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commitfd0e93588675982832ee075d11d9953aca97407e (patch)
tree4fb7fda01500b9e40ba182b5a7b7b4beebbb7ff6
parented6938ef5063db1ca82d9c078bb37216b1ea7eba (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3247
-rw-r--r--time.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/time.c b/time.c
index f07eddb91e..457fac9748 100644
--- a/time.c
+++ b/time.c
@@ -5328,8 +5328,7 @@ time_mload(VALUE time, VALUE str)
StringValue(str);
buf = (unsigned char *)RSTRING_PTR(str);
if (RSTRING_LEN(str) < base_dump_size) {
- invalid_format:
- rb_raise(rb_eTypeError, "marshaled time format differ");
+ goto invalid_format;
}
p = s = 0;
@@ -5432,6 +5431,9 @@ end_submicro: ;
}
return time;
+
+ invalid_format:
+ rb_raise(rb_eTypeError, "marshaled time format differ");
}
/* :nodoc: */