summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-04 02:24:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-04 02:24:15 +0000
commit4b85e88174eea7a79d9c68210d716dc3e4c4f0eb (patch)
treeef0e8d1db1b3072c40ee0d3c68859fd7511b1e53 /re.c
parentb0ec083a20c7b717492994f1ad7a03a97540f218 (diff)
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
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();