summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-16 15:32:39 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit7cf4625690454db5001ec5b13a88ef0d53a85bc9 (patch)
tree21be41e86f1687a40327ec25ef57a1397e3a1a16 /ruby.c
parent689dd3aecbf6177caad793c18c1c6ab4a7cc2150 (diff)
feature_option: 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
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ruby.c b/ruby.c
index a96bf1e..c3ee2ff 100644
--- a/ruby.c
+++ b/ruby.c
@@ -911,9 +911,7 @@ feature_option(const char *str, int len, void *arg, const unsigned int enable)
if (NAME_MATCH_P(#bit, str, len)) {set |= mask = FEATURE_BIT(bit); FEATURE_FOUND;}
EACH_FEATURES(SET_FEATURE, ;);
if (NAME_MATCH_P("all", str, len)) {
- found:
- FEATURE_SET_TO(*argp, mask, (mask & enable));
- return;
+ goto found;
}
#if AMBIGUOUS_FEATURE_NAMES
if (matched == 1) goto found;
@@ -933,6 +931,11 @@ feature_option(const char *str, int len, void *arg, const unsigned int enable)
rb_warn("unknown argument for --%s: `%.*s'",
enable ? "enable" : "disable", len, str);
rb_warn("features are [%.*s].", (int)strlen(list), list);
+ return;
+
+ found:
+ FEATURE_SET_TO(*argp, mask, (mask & enable));
+ return;
}
static void