aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-17 17:10:01 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-17 17:10:01 +0000
commitd202361d812e2d5ea036e7e88d32ef4d485b73f3 (patch)
tree956ec7aa44d495e1a581228bbc121f681c0533c2 /re.c
parenta14a58b959405ca4f7b8472f331a404269daeb2e (diff)
downloadruby-d202361d812e2d5ea036e7e88d32ef4d485b73f3.tar.gz
* re.c (match_aref): remove useless condition and call rb_fix2int.
rb_reg_nth_match handles negative index. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/re.c b/re.c
index da600fbad4..091168528f 100644
--- a/re.c
+++ b/re.c
@@ -1888,9 +1888,7 @@ match_aref(int argc, VALUE *argv, VALUE match)
if (NIL_P(rest)) {
if (FIXNUM_P(idx)) {
- if (FIX2INT(idx) >= 0) {
- return rb_reg_nth_match(FIX2INT(idx), match);
- }
+ return rb_reg_nth_match(FIX2INT(idx), match);
}
else {
int num = namev_to_backref_number(RMATCH_REGS(match), RMATCH(match)->regexp, idx);