diff options
author | 卜部昌平 <[email protected]> | 2020-06-15 15:31:07 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-06-29 11:05:41 +0900 |
commit | e551dfda9f09b69eb242db8877407daaa2537c4b (patch) | |
tree | 8e859ef20a398657140ed65eb498bc79683b1240 /load.c | |
parent | 9e92292e307fcdb3ef8e44f942135116de6616cf (diff) |
rb_feature_p: 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 'load.c')
-rw-r--r-- | load.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -480,9 +480,7 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c } if (st_get_key(loading_tbl, (st_data_t)feature, &data)) { if (fn) *fn = (const char*)data; - loading: - if (!ext) return 'u'; - return !IS_RBEXT(ext) ? 's' : 'r'; + goto loading; } else { VALUE bufstr; @@ -514,6 +512,10 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c rb_str_resize(bufstr, 0); } return 0; + + loading: + if (!ext) return 'u'; + return !IS_RBEXT(ext) ? 's' : 'r'; } int |