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

8
load.c
View File

@ -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