summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-15 14:36:41 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commitc5f43451389a9a19d14c34e553d271038a87be99 (patch)
treef2f79054330f3ae0b7b32d5df3bd2ddfb5e16614 /gc.c
parent228118482e4df04e42b64bca09f7bf2306c2314f (diff)
get_envparam_double: 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 'gc.c')
-rw-r--r--gc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gc.c b/gc.c
index 05b8fb3b45..a2a7997a72 100644
--- a/gc.c
+++ b/gc.c
@@ -9389,13 +9389,15 @@ get_envparam_double(const char *name, double *default_value, double lower_bound,
}
}
else {
- accept:
- if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (default value: %f)\n", name, val, *default_value);
- *default_value = val;
- return 1;
+ goto accept;
}
}
return 0;
+
+ accept:
+ if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (default value: %f)\n", name, val, *default_value);
+ *default_value = val;
+ return 1;
}
static void