summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-11 17:35:03 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-11 17:35:03 +0000
commitcc3540ba811a2f0f44a5e2794f961f946e9239eb (patch)
tree89fb1d18a3eee71f5bda315c8e85a26b228c0db5 /string.c
parentb9190c6a5af2e8705ed6b151da6641f5f9191700 (diff)
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_4@57864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/string.c b/string.c
index 97eb9436c3..3af9b08b83 100644
--- a/string.c
+++ b/string.c
@@ -3493,10 +3493,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_PTR(sub) || 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;