mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
rb_strftime_with_timespec: 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:
parent
b5eeb3453e
commit
31a770ac48
Notes:
git
2020-06-29 11:06:50 +09:00
1 changed files with 4 additions and 2 deletions
|
@ -266,8 +266,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len,
|
||||||
static const char ampm[][3] = { "AM", "PM", };
|
static const char ampm[][3] = { "AM", "PM", };
|
||||||
|
|
||||||
if (format == NULL || format_len == 0 || vtm == NULL) {
|
if (format == NULL || format_len == 0 || vtm == NULL) {
|
||||||
err:
|
goto err;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enc &&
|
if (enc &&
|
||||||
|
@ -911,6 +910,9 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len,
|
||||||
rb_str_set_len(ftime, len);
|
rb_str_set_len(ftime, len);
|
||||||
rb_str_resize(ftime, len);
|
rb_str_resize(ftime, len);
|
||||||
return ftime;
|
return ftime;
|
||||||
|
|
||||||
|
err:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
|
|
Loading…
Reference in a new issue