summaryrefslogtreecommitdiff
path: root/strftime.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-17 14:49:16 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit31a770ac4827b6c9404d9506d234c23fd00da0f4 (patch)
tree8281e881c6ecc81c954276ae495777fef5f874c5 /strftime.c
parentb5eeb3453e7c3047ce3e4f39e8ae89af4fafb16f (diff)
downloadruby-31a770ac4827b6c9404d9506d234c23fd00da0f4.tar.gz
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.
Diffstat (limited to 'strftime.c')
-rw-r--r--strftime.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/strftime.c b/strftime.c
index 0a080357b5..f4180fdb9e 100644
--- a/strftime.c
+++ b/strftime.c
@@ -266,8 +266,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len,
static const char ampm[][3] = { "AM", "PM", };
if (format == NULL || format_len == 0 || vtm == NULL) {
- err:
- return 0;
+ goto err;
}
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_resize(ftime, len);
return ftime;
+
+err:
+ return 0;
}
static size_t