From 4b85e88174eea7a79d9c68210d716dc3e4c4f0eb Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 4 Dec 2018 02:24:15 +0000 Subject: Prefer rb_check_arity when 0 or 1 arguments git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- re.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 're.c') diff --git a/re.c b/re.c index 84027707e0..1218877684 100644 --- a/re.c +++ b/re.c @@ -3960,13 +3960,11 @@ match_setter(VALUE val) static VALUE rb_reg_s_last_match(int argc, VALUE *argv) { - VALUE nth; - - if (argc > 0 && rb_scan_args(argc, argv, "01", &nth) == 1) { + if (rb_check_arity(argc, 0, 1) == 1) { VALUE match = rb_backref_get(); int n; if (NIL_P(match)) return Qnil; - n = match_backref_number(match, nth); + n = match_backref_number(match, argv[0]); return rb_reg_nth_match(n, match); } return match_getter(); -- cgit v1.2.3