From 0d528f4a2942c46c2d62fe13514f1acd8b8cbbc9 Mon Sep 17 00:00:00 2001 From: usa Date: Sat, 25 Mar 2017 16:29:17 +0000 Subject: merge revision(s) 57374: [Backport #13135] string.c: rindex(//) should set $~. This seems a bug introduced by r520 (1.4.0). [ruby-core:79110] [Bug #13135] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 89723a08da..ade2be20b9 100644 --- a/string.c +++ b/string.c @@ -3083,10 +3083,8 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str) pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos, enc, single_byte_optimizable(str)); - if (!RREGEXP(sub)->ptr || RREGEXP_SRC_LEN(sub)) { - pos = rb_reg_search(sub, str, pos, 1); - pos = rb_str_sublen(str, pos); - } + pos = rb_reg_search(sub, str, pos, 1); + pos = rb_str_sublen(str, pos); if (pos >= 0) return LONG2NUM(pos); break; -- cgit v1.2.3