summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authorEric Wong <normal@ruby-lang.org>2022-12-27 01:32:07 +0000
committerEric Wong <normal@ruby-lang.org>2022-12-27 01:32:07 +0000
commitdb19714b17e365d11ceb13e0d16c8cf3c837f38c (patch)
tree7dfbd170b9a55f891af4cf5296a1f4025ac6ffc3 /load.c
parentc09f342d04c62c9a75c855bad92efe06ee698280 (diff)
downloadruby-db19714b17e365d11ceb13e0d16c8cf3c837f38c.tar.gz
load.c: remove unneeded rb_str_freeze calls
rb_fstring already resizes and freezes the string, so there's no need to use rb_str_freeze.
Diffstat (limited to 'load.c')
-rw-r--r--load.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/load.c b/load.c
index 282bebdb62..ce52e5ef60 100644
--- a/load.c
+++ b/load.c
@@ -367,7 +367,7 @@ get_loaded_features_index(rb_vm_t *vm)
VALUE entry, as_str;
as_str = entry = rb_ary_entry(features, i);
StringValue(as_str);
- as_str = rb_fstring(rb_str_freeze(as_str));
+ as_str = rb_fstring(as_str);
if (as_str != entry)
rb_ary_store(features, i, as_str);
features_index_add(vm, as_str, INT2FIX(i));
@@ -655,14 +655,14 @@ rb_provide_feature(rb_vm_t *vm, VALUE feature)
rb_raise(rb_eRuntimeError,
"$LOADED_FEATURES is frozen; cannot append feature");
}
- rb_str_freeze(feature);
+ feature = rb_fstring(feature);
get_loaded_features_index(vm);
// If loaded_features and loaded_features_snapshot share the same backing
// array, pushing into it would cause the whole array to be copied.
// To avoid this we first clear loaded_features_snapshot.
rb_ary_clear(vm->loaded_features_snapshot);
- rb_ary_push(features, rb_fstring(feature));
+ rb_ary_push(features, feature);
features_index_add(vm, feature, INT2FIX(RARRAY_LEN(features)-1));
reset_loaded_features_snapshot(vm);
}