summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-01 10:25:48 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-01 10:25:48 +0000
commit8cdfbfd844060c20e7de34796cc9171383fc5e20 (patch)
tree5b22f3fc77e6e6b901a96072463760f7a0529b23 /string.c
parent51d1c5e73bf44baecf598b8997a0d291518da351 (diff)
* 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
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 1 insertions, 2 deletions
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();