mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
string.c: scan coderange
* string.c (rb_str_conv_enc_opts): make sure to scan coderange to get rid of unnecessary conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4c0eeec0f0
commit
1b3adaefd9
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Sep 21 00:47:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_conv_enc_opts): make sure to scan coderange to get
|
||||
rid of unnecessary conversion.
|
||||
|
||||
Sat Sep 21 00:21:08 2013 Zachary Scott <e@zzak.io>
|
||||
|
||||
* ext/openssl/lib/openssl/ssl.rb: [DOC] Document OpenSSL::SSLServer
|
||||
|
|
2
string.c
2
string.c
|
@ -554,7 +554,7 @@ rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags,
|
|||
if (!to) return str;
|
||||
if (!from) from = rb_enc_get(str);
|
||||
if (from == to) return str;
|
||||
if ((rb_enc_asciicompat(to) && ENC_CODERANGE(str) == ENC_CODERANGE_7BIT) ||
|
||||
if ((rb_enc_asciicompat(to) && is_ascii_string(str)) ||
|
||||
to == rb_ascii8bit_encoding()) {
|
||||
if (STR_ENC_GET(str) != to) {
|
||||
str = rb_str_dup(str);
|
||||
|
|
Loading…
Add table
Reference in a new issue