mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_chomp_bang): wrong adjust condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1c7f24d5b1
commit
3e212b0484
2 changed files with 5 additions and 3 deletions
|
@ -6,6 +6,8 @@ Wed Dec 19 22:59:52 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
* string.c (rb_str_chomp_bang): check if match start at the head
|
* string.c (rb_str_chomp_bang): check if match start at the head
|
||||||
of a character.
|
of a character.
|
||||||
|
|
||||||
|
* string.c (rb_str_chomp_bang): wrong adjust condition.
|
||||||
|
|
||||||
Wed Dec 19 21:42:18 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Dec 19 21:42:18 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* re.c (rb_reg_regsub): should set checked encoding.
|
* re.c (rb_reg_regsub): should set checked encoding.
|
||||||
|
|
6
string.c
6
string.c
|
@ -4523,12 +4523,12 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
|
||||||
if (is_broken_string(rs)) {
|
if (is_broken_string(rs)) {
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
pp = p + len - rslen;
|
e = p + len;
|
||||||
|
pp = e - rslen;
|
||||||
if (p[len-1] == newline &&
|
if (p[len-1] == newline &&
|
||||||
(rslen <= 1 ||
|
(rslen <= 1 ||
|
||||||
memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {
|
memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {
|
||||||
if (!isascii(*pp)) {
|
if (rb_enc_mbmaxlen(enc) > 1) {
|
||||||
e = p+len;
|
|
||||||
while (p < pp) {
|
while (p < pp) {
|
||||||
p += rb_enc_mbclen(p, e, enc);
|
p += rb_enc_mbclen(p, e, enc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue