diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-19 12:44:57 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | ce6be8889f10632f8ee0a52aaf86a4a598e74af1 (patch) | |
tree | 1fa894a2883b5e8531071af33c020199c1c2dd6c | |
parent | 1c0a97bfad9943d796ef9ba5e28c967397a80b77 (diff) |
utc_offset_arg: 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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2079,8 +2079,7 @@ utc_offset_arg(VALUE arg) int n = 0; char *s = RSTRING_PTR(tmp); if (!rb_enc_str_asciicompat_p(tmp)) { - invalid_utc_offset: - return Qnil; + goto invalid_utc_offset; } switch (RSTRING_LEN(tmp)) { case 1: @@ -2131,6 +2130,8 @@ utc_offset_arg(VALUE arg) else { return num_exact(arg); } + invalid_utc_offset: + return Qnil; } static void |