summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorKazuhiro NISHIYAMA <zn@mbf.nifty.com>2020-01-05 11:52:39 +0900
committerKazuhiro NISHIYAMA <zn@mbf.nifty.com>2020-01-05 12:26:37 +0900
commit787c6d591aa0a170d5f5b714df7aea6de6c5f0a2 (patch)
tree2cb86259b6dd9a1493bb72ec5f258f0a3ce0ee85 /class.c
parent5b0c3754d8578564e12df7182fff4a36b0a29938 (diff)
Remove unused last_idx in class.c
ref c7f01d889becbeffc4254e1b0b7faecb80ea3f3e and beae6cbf0fd8b6619e5212552de98022d4c4d4d4
Diffstat (limited to 'class.c')
-rw-r--r--class.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/class.c b/class.c
index 7db54d6..cda43de 100644
--- a/class.c
+++ b/class.c
@@ -1958,7 +1958,6 @@ struct rb_scan_args_t {
int n_trail;
int n_mand;
int argi;
- int last_idx;
VALUE hash;
VALUE last_hash;
VALUE *tmp_buffer;
@@ -1972,7 +1971,6 @@ rb_scan_args_parse(int kw_flag, int argc, const VALUE *argv, const char *fmt, st
int last_hash_keyword = 0;
memset(arg, 0, sizeof(*arg));
- arg->last_idx = -1;
arg->hash = Qnil;
switch (kw_flag) {
@@ -2043,14 +2041,14 @@ rb_scan_args_assign(struct rb_scan_args_t *arg, va_list vargs)
/* capture leading mandatory arguments */
for (i = arg->n_lead; i-- > 0; ) {
var = va_arg(vargs, VALUE *);
- if (var) *var = (argi == arg->last_idx) ? arg->last_hash : arg->argv[argi];
+ if (var) *var = arg->argv[argi];
argi++;
}
/* capture optional arguments */
for (i = arg->n_opt; i-- > 0; ) {
var = va_arg(vargs, VALUE *);
if (argi < arg->argc - arg->n_trail) {
- if (var) *var = (argi == arg->last_idx) ? arg->last_hash : arg->argv[argi];
+ if (var) *var = arg->argv[argi];
argi++;
}
else {
@@ -2064,7 +2062,7 @@ rb_scan_args_assign(struct rb_scan_args_t *arg, va_list vargs)
var = va_arg(vargs, VALUE *);
if (0 < n_var) {
if (var) {
- int f_last = (arg->last_idx + 1 == arg->argc - arg->n_trail);
+ int f_last = (arg->argc == arg->n_trail);
*var = rb_ary_new4(n_var - f_last, &arg->argv[argi]);
if (f_last) rb_ary_push(*var, arg->last_hash);
}
@@ -2077,7 +2075,7 @@ rb_scan_args_assign(struct rb_scan_args_t *arg, va_list vargs)
/* capture trailing mandatory arguments */
for (i = arg->n_trail; i-- > 0; ) {
var = va_arg(vargs, VALUE *);
- if (var) *var = (argi == arg->last_idx) ? arg->last_hash : arg->argv[argi];
+ if (var) *var = arg->argv[argi];
argi++;
}
/* capture an option hash - phase 2: assignment */