summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-23 07:46:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-23 07:46:12 +0000
commitc68d29960b4027da6fed55576a523f42f6182f28 (patch)
treeb045e6c69426ce719b704ab6a977afcc8cb4f8fe /load.c
parent2933909caf01896d45eefa23e9c839fd1e03d652 (diff)
load.c: keep encoding of feature name
* file.c (rb_find_file_ext_safe, rb_find_file_safe): default to US-ASCII for encdb and transdb. * load.c (search_required): keep encoding of feature name. set loading path to filesystem encoding. [Bug #6377][ruby-core:44750] * ruby.c (add_modules, require_libraries): assume default external encoding as well as ARGV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 fd5f862ebd..7f1b3f65b8 100644
--- a/load.c
+++ b/load.c
@@ -516,7 +516,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) {
@@ -529,10 +529,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)) {
@@ -554,7 +554,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) {
@@ -566,7 +566,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;