summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
Diffstat (limited to 'load.c')
-rw-r--r--load.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/load.c b/load.c
index 13dbff5e96..72ca0ebc3b 100644
--- a/load.c
+++ b/load.c
@@ -498,7 +498,7 @@ search_required(VALUE fname, volatile VALUE *path, int safe_level)
if (ext && !strchr(ext, '/')) {
if (IS_RBEXT(ext)) {
if (rb_feature_p(ftptr, ext, TRUE, FALSE, &loading)) {
- if (loading) *path = rb_str_new2(loading);
+ if (loading) *path = rb_filesystem_str_new_cstr(loading);
return 'r';
}
if ((tmp = rb_find_file_safe(fname, safe_level)) != 0) {
@@ -511,10 +511,10 @@ search_required(VALUE fname, volatile VALUE *path, int safe_level)
}
else if (IS_SOEXT(ext)) {
if (rb_feature_p(ftptr, ext, FALSE, FALSE, &loading)) {
- if (loading) *path = rb_str_new2(loading);
+ if (loading) *path = rb_filesystem_str_new_cstr(loading);
return 's';
}
- tmp = rb_str_new(RSTRING_PTR(fname), ext - RSTRING_PTR(fname));
+ tmp = rb_str_subseq(fname, 0, ext - RSTRING_PTR(fname));
#ifdef DLEXT2
OBJ_FREEZE(tmp);
if (rb_find_file_ext_safe(&tmp, loadable_ext + 1, safe_level)) {
@@ -536,7 +536,7 @@ search_required(VALUE fname, volatile VALUE *path, int safe_level)
}
else if (IS_DLEXT(ext)) {
if (rb_feature_p(ftptr, ext, FALSE, FALSE, &loading)) {
- if (loading) *path = rb_str_new2(loading);
+ if (loading) *path = rb_filesystem_str_new_cstr(loading);
return 's';
}
if ((tmp = rb_find_file_safe(fname, safe_level)) != 0) {
@@ -548,7 +548,7 @@ search_required(VALUE fname, volatile VALUE *path, int safe_level)
}
}
else if ((ft = rb_feature_p(ftptr, 0, FALSE, FALSE, &loading)) == 'r') {
- if (loading) *path = rb_str_new2(loading);
+ if (loading) *path = rb_filesystem_str_new_cstr(loading);
return 'r';
}
tmp = fname;