From e9ff4a22dfbd07ea6c54179979d937ff739eead3 Mon Sep 17 00:00:00 2001 From: usa Date: Tue, 16 Oct 2012 02:11:36 +0000 Subject: 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 --- load.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'load.c') 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; -- cgit v1.2.3