Replace expanded load path only when modified
This commit is contained in:
parent
b6534691a1
commit
409dbc951b
Notes:
git
2021-10-01 20:29:13 +09:00
6
ruby.c
6
ruby.c
@ -1931,13 +1931,17 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
VALUE loaded_features = vm->loaded_features;
|
VALUE loaded_features = vm->loaded_features;
|
||||||
|
bool modified = false;
|
||||||
for (long i = loaded_before_enc; i < RARRAY_LEN(loaded_features); ++i) {
|
for (long i = loaded_before_enc; i < RARRAY_LEN(loaded_features); ++i) {
|
||||||
VALUE path = RARRAY_AREF(loaded_features, i);
|
VALUE path = RARRAY_AREF(loaded_features, i);
|
||||||
if (rb_enc_get(path) == IF_UTF8_PATH(uenc, lenc)) continue;
|
if (rb_enc_get(path) == IF_UTF8_PATH(uenc, lenc)) continue;
|
||||||
path = copy_str(path, IF_UTF8_PATH(uenc, lenc), true);
|
path = copy_str(path, IF_UTF8_PATH(uenc, lenc), true);
|
||||||
|
modified = true;
|
||||||
RARRAY_ASET(loaded_features, i, path);
|
RARRAY_ASET(loaded_features, i, path);
|
||||||
}
|
}
|
||||||
rb_get_expanded_load_path();
|
if (modified) {
|
||||||
|
rb_ary_replace(vm->loaded_features_snapshot, loaded_features);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt->features.mask & COMPILATION_FEATURES) {
|
if (opt->features.mask & COMPILATION_FEATURES) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user