Skip to content

Commit 6e675c1

Browse files
committed
py/objdeque: Use m_new0 when allocating items to avoid need to clear.
Saves a few bytes of code space, and is more efficient because with MICROPY_GC_CONSERVATIVE_CLEAR enabled by default all memory is already cleared when allocated.
1 parent 160d670 commit 6e675c1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

py/objdeque.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ STATIC mp_obj_t deque_make_new(const mp_obj_type_t *type, size_t n_args, size_t
6060
o->base.type = type;
6161
o->alloc = maxlen + 1;
6262
o->i_get = o->i_put = 0;
63-
o->items = m_new(mp_obj_t, o->alloc);
64-
mp_seq_clear(o->items, 0, o->alloc, sizeof(*o->items));
63+
o->items = m_new0(mp_obj_t, o->alloc);
6564

6665
if (n_args > 2) {
6766
o->flags = mp_obj_get_int(args[2]);

0 commit comments

Comments
 (0)