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

* string.c (tr_trans): change condition of singlebyte optimization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2009-08-01 10:25:48 +00:00
parent 51d1c5e73b
commit 8cdfbfd844
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Sat Aug 1 19:23:27 2009 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (tr_trans): change condition of singlebyte
optimization.
Sat Aug 1 18:50:53 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Aug 1 18:50:53 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* random.c (random_float): rejects Infinity and NaN. * random.c (random_float): rejects Infinity and NaN.

View file

@ -4871,8 +4871,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
if (r == errc) r = trrepl.now; if (r == errc) r = trrepl.now;
if (c < 256) { if (c < 256) {
trans[c] = r; trans[c] = r;
if (r > 255 || (r > 127 && rb_enc_mbmaxlen(enc) != 1)) if (rb_enc_codelen(r, enc) != 1) singlebyte = 0;
singlebyte = 0;
} }
else { else {
if (!hash) hash = rb_hash_new(); if (!hash) hash = rb_hash_new();