summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-08 15:31:35 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-08 15:31:35 +0000
commit04f65b4127c7f15fa65d10ef910d15dc34613970 (patch)
treeb7bb3649d7215595fa32ccfa1a1ed3f7c3437819 /string.c
parent944148dd91973b4e991b1ba6cd0514e1f055fb31 (diff)
merges r24342 and r24348 from trunk into ruby_1_9_1.
-- Can't use singlebyte optimization when the replacement is multibyte. [ruby-core:24612] * string.c (tr_trans): can't use singlebyte optimization when the replacement is multibyte. [ruby-core:24612] -- * string.c (tr_trans): change condition of singlebyte optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@24457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index c27e5d4863..2017d1023b 100644
--- a/string.c
+++ b/string.c
@@ -4681,7 +4681,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) singlebyte = 0;
+ if (rb_enc_codelen(r, enc) != 1) singlebyte = 0;
}
else {
if (!hash) hash = rb_hash_new();