load.c: move loop invariant condition
* load.c (rb_feature_p): move this_feature_index condition which is loop invariant. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8237581a2e
commit
1b7143309b
68
load.c
68
load.c
@ -406,40 +406,42 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c
|
|||||||
or ends in '/'. This includes both match forms above, as well
|
or ends in '/'. This includes both match forms above, as well
|
||||||
as any distractors, so we may ignore all other entries in `features`.
|
as any distractors, so we may ignore all other entries in `features`.
|
||||||
*/
|
*/
|
||||||
for (i = 0; !NIL_P(this_feature_index); i++) {
|
if (!NIL_P(this_feature_index)) {
|
||||||
VALUE entry;
|
for (i = 0; ; i++) {
|
||||||
long index;
|
VALUE entry;
|
||||||
if (RB_TYPE_P(this_feature_index, T_ARRAY)) {
|
long index;
|
||||||
if (i >= RARRAY_LEN(this_feature_index)) break;
|
if (RB_TYPE_P(this_feature_index, T_ARRAY)) {
|
||||||
entry = RARRAY_PTR(this_feature_index)[i];
|
if (i >= RARRAY_LEN(this_feature_index)) break;
|
||||||
}
|
entry = RARRAY_PTR(this_feature_index)[i];
|
||||||
else {
|
}
|
||||||
if (i > 0) break;
|
else {
|
||||||
entry = this_feature_index;
|
if (i > 0) break;
|
||||||
}
|
entry = this_feature_index;
|
||||||
index = FIX2LONG(entry);
|
}
|
||||||
|
index = FIX2LONG(entry);
|
||||||
|
|
||||||
v = RARRAY_PTR(features)[index];
|
v = RARRAY_PTR(features)[index];
|
||||||
f = StringValuePtr(v);
|
f = StringValuePtr(v);
|
||||||
if ((n = RSTRING_LEN(v)) < len) continue;
|
if ((n = RSTRING_LEN(v)) < len) continue;
|
||||||
if (strncmp(f, feature, len) != 0) {
|
if (strncmp(f, feature, len) != 0) {
|
||||||
if (expanded) continue;
|
if (expanded) continue;
|
||||||
if (!load_path) load_path = rb_get_expanded_load_path();
|
if (!load_path) load_path = rb_get_expanded_load_path();
|
||||||
if (!(p = loaded_feature_path(f, n, feature, len, type, load_path)))
|
if (!(p = loaded_feature_path(f, n, feature, len, type, load_path)))
|
||||||
continue;
|
continue;
|
||||||
expanded = 1;
|
expanded = 1;
|
||||||
f += RSTRING_LEN(p) + 1;
|
f += RSTRING_LEN(p) + 1;
|
||||||
}
|
}
|
||||||
if (!*(e = f + len)) {
|
if (!*(e = f + len)) {
|
||||||
if (ext) continue;
|
if (ext) continue;
|
||||||
return 'u';
|
return 'u';
|
||||||
}
|
}
|
||||||
if (*e != '.') continue;
|
if (*e != '.') continue;
|
||||||
if ((!rb || !ext) && (IS_SOEXT(e) || IS_DLEXT(e))) {
|
if ((!rb || !ext) && (IS_SOEXT(e) || IS_DLEXT(e))) {
|
||||||
return 's';
|
return 's';
|
||||||
}
|
}
|
||||||
if ((rb || !ext) && (IS_RBEXT(e))) {
|
if ((rb || !ext) && (IS_RBEXT(e))) {
|
||||||
return 'r';
|
return 'r';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user