diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-13 16:04:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-13 16:04:05 +0000 |
commit | 7323de517d3459542ba7a6ef72152078b1f50fdf (patch) | |
tree | bf6c7fa12d6a7adaf0f096a26423a728c2a3b625 /string.c | |
parent | 0843c1ca37aa9205620a51e757658d016e1565a3 (diff) |
revert r58703 & r58705
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 18 |
1 files changed, 2 insertions, 16 deletions
@@ -997,24 +997,10 @@ rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to) 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 |