mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Hoisted out rb_scan_args_result
This commit is contained in:
parent
0742585e7e
commit
9bc815aa5f
1 changed files with 11 additions and 8 deletions
19
class.c
19
class.c
|
@ -2079,6 +2079,15 @@ rb_scan_args_assign(const struct rb_scan_args_t *arg, int argc, const VALUE *con
|
||||||
return argc;
|
return argc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
rb_scan_args_result(const struct rb_scan_args_t *const arg, int argc)
|
||||||
|
{
|
||||||
|
if (argc < 0) {
|
||||||
|
rb_error_arity(-1-argc, arg->n_mand, arg->f_var ? UNLIMITED_ARGUMENTS : arg->n_mand + arg->n_opt);
|
||||||
|
}
|
||||||
|
return argc;
|
||||||
|
}
|
||||||
|
|
||||||
#undef rb_scan_args
|
#undef rb_scan_args
|
||||||
int
|
int
|
||||||
rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
|
rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
|
||||||
|
@ -2089,10 +2098,7 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
|
||||||
va_start(vargs,fmt);
|
va_start(vargs,fmt);
|
||||||
argc = rb_scan_args_assign(&arg, argc, argv, vargs);
|
argc = rb_scan_args_assign(&arg, argc, argv, vargs);
|
||||||
va_end(vargs);
|
va_end(vargs);
|
||||||
if (argc < 0) {
|
return rb_scan_args_result(&arg, argc);
|
||||||
rb_error_arity(-1-argc, arg.n_mand, arg.f_var ? UNLIMITED_ARGUMENTS : arg.n_mand + arg.n_opt);
|
|
||||||
}
|
|
||||||
return argc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef rb_scan_args_kw
|
#undef rb_scan_args_kw
|
||||||
|
@ -2105,10 +2111,7 @@ rb_scan_args_kw(int kw_flag, int argc, const VALUE *argv, const char *fmt, ...)
|
||||||
va_start(vargs,fmt);
|
va_start(vargs,fmt);
|
||||||
argc = rb_scan_args_assign(&arg, argc, argv, vargs);
|
argc = rb_scan_args_assign(&arg, argc, argv, vargs);
|
||||||
va_end(vargs);
|
va_end(vargs);
|
||||||
if (argc < 0) {
|
return rb_scan_args_result(&arg, argc);
|
||||||
rb_error_arity(-1-argc, arg.n_mand, arg.f_var ? UNLIMITED_ARGUMENTS : arg.n_mand + arg.n_opt);
|
|
||||||
}
|
|
||||||
return argc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Add table
Reference in a new issue