diff --git a/ChangeLog b/ChangeLog index 67b8869151..898e7191f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Aug 1 19:23:27 2009 NARUSE, Yui + + * string.c (tr_trans): change condition of singlebyte + optimization. + Sat Aug 1 18:50:53 2009 Nobuyoshi Nakada * random.c (random_float): rejects Infinity and NaN. diff --git a/string.c b/string.c index 6e6db0053a..06edf3b8d1 100644 --- a/string.c +++ b/string.c @@ -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();