summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c6
1 files changed, 2 insertions, 4 deletions
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();