ruby-changes:42963
From: naruse <ko1@a...>
Date: Wed, 18 May 2016 02:10:07 +0900 (JST)
Subject: [ruby-changes:42963] naruse:r55037 (trunk): * re.c (match_aref): remove useless condition and call rb_fix2int.
naruse 2016-05-18 02:10:01 +0900 (Wed, 18 May 2016) New Revision: 55037 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55037 Log: * re.c (match_aref): remove useless condition and call rb_fix2int. rb_reg_nth_match handles negative index. Modified files: trunk/ChangeLog trunk/re.c Index: ChangeLog =================================================================== --- ChangeLog (revision 55036) +++ ChangeLog (revision 55037) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed May 18 02:02:58 2016 NARUSE, Yui <naruse@r...> + + * re.c (match_aref): remove useless condition and call rb_fix2int. + rb_reg_nth_match handles negative index. + Wed May 18 01:57:43 2016 NARUSE, Yui <naruse@r...> * re.c (match_values_at): MatchData#values_at supports named captures Index: re.c =================================================================== --- re.c (revision 55036) +++ re.c (revision 55037) @@ -1888,9 +1888,7 @@ match_aref(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/re.c#L1888 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/