aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-19 14:38:46 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-19 14:38:46 +0000
commit3e212b0484bb1f7106b4466209a8f507e718a96b (patch)
tree63751cb2b2412ea399e8a0f9f6ec5740c4602f08
parent1c7f24d5b16ee21867b628535bd30556608086be (diff)
downloadruby-3e212b0484bb1f7106b4466209a8f507e718a96b.tar.gz
* 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
-rw-r--r--ChangeLog2
-rw-r--r--string.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index df48d90713..de247ca11e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
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>
* re.c (rb_reg_regsub): should set checked encoding.
diff --git a/string.c b/string.c
index ae81b4b28d..9a9de2e64b 100644
--- a/string.c
+++ b/string.c
@@ -4523,12 +4523,12 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
if (is_broken_string(rs)) {
return Qnil;
}
- pp = p + len - rslen;
+ e = p + len;
+ pp = e - rslen;
if (p[len-1] == newline &&
(rslen <= 1 ||
memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {
- if (!isascii(*pp)) {
- e = p+len;
+ if (rb_enc_mbmaxlen(enc) > 1) {
while (p < pp) {
p += rb_enc_mbclen(p, e, enc);
}