summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-16 02:11:36 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-16 02:11:36 +0000
commite9ff4a22dfbd07ea6c54179979d937ff739eead3 (patch)
tree03b87b343800f7dd25c718942366d1b0cc48b2f0 /load.c
parentae5930a892da55dddc8513dde50b0dc65572ca3a (diff)
merge revision(s) 36800: [Backport #6377]
* 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/branches/ruby_1_9_3@37209 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 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;