Skip to content

Commit

Permalink
py/runtime: Drop new_alloc < 4 check.
Browse files Browse the repository at this point in the history
To reach this check, n_kw has to be >= 1 and therefore args2_alloc has
to be >= 2. Therefore new_alloc will always be >= 4. So this check will
never be true and can be removed.

Signed-off-by: David Lechner <david@pybricks.com>
  • Loading branch information
dlech authored and dpgeorge committed Mar 31, 2022
1 parent 3679a47 commit 9b74d71
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions py/runtime.c
Expand Up @@ -860,9 +860,6 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_
// expand size of args array if needed
if (args2_len + 1 >= args2_alloc) {
uint new_alloc = args2_alloc * 2;
if (new_alloc < 4) {
new_alloc = 4;
}
args2 = mp_nonlocal_realloc(args2, args2_alloc * sizeof(mp_obj_t), new_alloc * sizeof(mp_obj_t));
args2_alloc = new_alloc;
}
Expand Down

0 comments on commit 9b74d71

Please sign in to comment.