diff options
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -4538,12 +4538,8 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str) if (p[len-1] == newline && (rslen <= 1 || memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) { - if (rb_enc_mbmaxlen(enc) > 1) { - while (p < pp) { - p += rb_enc_mbclen(p, e, enc); - } - if (p != pp) return Qnil; - } + if (ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,p,pp) != (const UChar*)pp) + return Qnil; rb_str_modify(str); STR_SET_LEN(str, RSTRING_LEN(str) - rslen); RSTRING_PTR(str)[RSTRING_LEN(str)] = '\0'; |