From 31a770ac4827b6c9404d9506d234c23fd00da0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Wed, 17 Jun 2020 14:49:16 +0900 Subject: 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. --- strftime.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'strftime.c') 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 -- cgit v1.2.1