diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-15 14:36:41 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | c5f43451389a9a19d14c34e553d271038a87be99 (patch) | |
tree | f2f79054330f3ae0b7b32d5df3bd2ddfb5e16614 /gc.c | |
parent | 228118482e4df04e42b64bca09f7bf2306c2314f (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.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 |