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.
This commit is contained in:
卜部昌平 2020-06-15 16:04:52 +09:00
parent e551dfda9f
commit 6575766ea0
Notes: git 2020-06-29 11:07:01 +09:00

8
load.c
View File

@ -924,9 +924,7 @@ search_required(VALUE fname, volatile VALUE *path, feature_func rb_feature_p)
default: default:
if (ft) { if (ft) {
statically_linked: goto statically_linked;
if (loading) *path = rb_filesystem_str_new_cstr(loading);
return ft;
} }
/* fall through */ /* fall through */
case 1: case 1:
@ -936,6 +934,10 @@ search_required(VALUE fname, volatile VALUE *path, feature_func rb_feature_p)
*path = tmp; *path = tmp;
} }
return type ? 's' : 'r'; return type ? 's' : 'r';
statically_linked:
if (loading) *path = rb_filesystem_str_new_cstr(loading);
return ft;
} }
static void static void