* string.c (tr_trans): single '^' does not mean negation.

[ruby-dev:34632]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-05-10 13:15:13 +00:00
parent 9139a48f0e
commit ef14215c51
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Sat May 10 22:14:03 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (tr_trans): single '^' does not mean negation.
[ruby-dev:34632]
Sat May 10 18:11:18 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_each_line): zero length record separator should

View File

@ -4243,7 +4243,9 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
enc = rb_enc_check(src, repl);
}
trsrc.p = RSTRING_PTR(src); trsrc.pend = trsrc.p + RSTRING_LEN(src);
if (RSTRING_LEN(str) > 1 && rb_enc_ascget(trsrc.p, trsrc.pend, &l, enc) == '^') {
if (RSTRING_LEN(str) > 1 &&
rb_enc_ascget(trsrc.p, trsrc.pend, &l, enc) == '^' &&
trsrc.p + l < trsrc.pend) {
cflag = 1;
trsrc.p += l;
}