ruby-changes:46592
From: nobu <ko1@a...>
Date: Sun, 14 May 2017 01:04:11 +0900 (JST)
Subject: [ruby-changes:46592] nobu:r58708 (trunk): revert r58703 & r58705
nobu 2017-05-14 01:04:05 +0900 (Sun, 14 May 2017) New Revision: 58708 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58708 Log: revert r58703 & r58705 Modified files: trunk/string.c Index: string.c =================================================================== --- string.c (revision 58707) +++ string.c (revision 58708) @@ -997,24 +997,10 @@ rb_str_conv_enc(VALUE str, rb_encoding * https://github.com/ruby/ruby/blob/trunk/string.c#L997 VALUE rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *eenc) { - rb_encoding *ienc; VALUE str; - if (!eenc || (eenc == rb_ascii8bit_encoding()) || - (eenc == rb_usascii_encoding() && search_nonascii(ptr, ptr + len))) { - return rb_tainted_str_new(ptr, len); - } - ienc = rb_default_internal_encoding(); - if (!ienc || eenc == ienc) { - return rb_tainted_str_new_with_enc(ptr, len, eenc); - } - str = rb_tainted_str_new_with_enc(NULL, 0, ienc); - if (NIL_P(rb_str_cat_conv_enc_opts(str, 0, ptr, len, eenc, 0, Qnil))) { - STR_SET_LEN(str, 0); - rb_enc_associate(str, eenc); - rb_str_cat(str, ptr, len); - } - return str; + str = rb_tainted_str_new_with_enc(ptr, len, eenc); + return rb_external_str_with_enc(str, eenc); } VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/