diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-08-01 10:25:48 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-08-01 10:25:48 +0000 |
commit | 55793f09324665a6495f79f4fa94e456fedb85e8 (patch) | |
tree | 5b22f3fc77e6e6b901a96072463760f7a0529b23 | |
parent | 85e1749a7c4e5de7b4bc19b2f4e9b563138900af (diff) | |
download | ruby-55793f09324665a6495f79f4fa94e456fedb85e8.tar.gz ruby-55793f09324665a6495f79f4fa94e456fedb85e8.tar.xz ruby-55793f09324665a6495f79f4fa94e456fedb85e8.zip |
* string.c (tr_trans): change condition of singlebyte optimization.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | string.c | 3 |
2 files changed, 6 insertions, 2 deletions
@@ -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> * random.c (random_float): rejects Infinity and NaN. @@ -4871,8 +4871,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag) if (r == errc) r = trrepl.now; if (c < 256) { trans[c] = r; - if (r > 255 || (r > 127 && rb_enc_mbmaxlen(enc) != 1)) - singlebyte = 0; + if (rb_enc_codelen(r, enc) != 1) singlebyte = 0; } else { if (!hash) hash = rb_hash_new(); |