summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-02 23:09:25 +0900
committerGitHub <noreply@github.com>2020-02-02 23:09:25 +0900
commitfae537259da3dd61fb62ae65d382a0ddc7c215dc (patch)
tree102ea1609bab37565c23628d7e8e65570fe3809b /class.c
parentf5806eb2067f905d71bdce0553dcfeb8585d1371 (diff)
Removed no longer used variable `last_hash`
1. By substituting `n_var` with its initializer, `0 < n_var` is equivalent to `argc > argi + n_trail`. 2. As `argi` is non-negative, so `argi + n_trail >= n_trail`, and the above expression is equivalent to `argc > n_trail`. 3. Therefore, `f_last` is always false, and `last_hash` is no longer used.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2873 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'class.c')
-rw-r--r--class.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/class.c b/class.c
index 46f7cc3..16b4a44 100644
--- a/class.c
+++ b/class.c
@@ -1964,7 +1964,6 @@ struct rb_scan_args_t {
int n_mand;
int argi;
VALUE hash;
- VALUE last_hash;
};
static void
@@ -2065,11 +2064,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->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);
- }
+ if (var) *var = rb_ary_new4(n_var, &arg->argv[argi]);
argi += n_var;
}
else {