aboutsummaryrefslogtreecommitdiffstats
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-03 12:27:24 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-03 12:27:24 +0000
commite094fedc2c6dcd93ebb4ef052236d002ae6ed6c9 (patch)
tree7939f3344a5c7893070ed856ec2201c7bc317689 /ruby.c
parent55530c55dff82bb53c4f162fb9bd15e2a41cdafa (diff)
downloadruby-e094fedc2c6dcd93ebb4ef052236d002ae6ed6c9.tar.gz
ruby.c: refix r55260
* ruby.c (process_options): rb_str_conv_enc() never set encoding of the source string, but returns the string itself if the conversion failed. then the instance variable does not need to be set again. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ruby.c b/ruby.c
index 37a0029a11..4c1e7844bf 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1568,7 +1568,9 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
VALUE path = RARRAY_AREF(load_path, i);
int mark = rb_attr_get(path, id_initial_load_path_mark) == path;
#if UTF8_PATH
- path = rb_str_conv_enc(rb_str_dup(path), uenc, lenc);
+ VALUE newpath = rb_str_conv_enc(path, uenc, lenc);
+ if (newpath == path) continue;
+ path = newpath;
#else
path = rb_enc_associate(rb_str_dup(path), lenc);
#endif