diff options
author | 卜部昌平 <[email protected]> | 2020-06-15 16:04:52 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-06-29 11:05:41 +0900 |
commit | 6575766ea04ec49a77dad36d4a200fbd7b263d22 (patch) | |
tree | 5bf063acb3bdc2b2cbe2bc719a372333c9490ea3 /load.c | |
parent | e551dfda9f09b69eb242db8877407daaa2537c4b (diff) |
search_required: 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
@@ -924,9 +924,7 @@ search_required(VALUE fname, volatile VALUE *path, feature_func rb_feature_p) default: if (ft) { - statically_linked: - if (loading) *path = rb_filesystem_str_new_cstr(loading); - return ft; + goto statically_linked; } /* fall through */ case 1: @@ -936,6 +934,10 @@ search_required(VALUE fname, volatile VALUE *path, feature_func rb_feature_p) *path = tmp; } return type ? 's' : 'r'; + + statically_linked: + if (loading) *path = rb_filesystem_str_new_cstr(loading); + return ft; } static void |