1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2016-06-03 12:27:24 +00:00
parent 8f86f5d691
commit 02687cd74f
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,10 @@
Fri Jun 3 21:27:22 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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.
Fri Jun 3 18:04:37 2016 NAKAMURA Usaku <usa@ruby-lang.org>
* ruby.c (process_options): need to duplicate path before passing it to

4
ruby.c
View file

@ -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