diff options
author | Damien George <damien.p.george@gmail.com> | 2018-02-21 23:36:46 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-02-21 23:36:46 +1100 |
commit | 6e675c1baaf0de0d56a2345376d6b5600bfab3aa (patch) | |
tree | e3c36af06c3e28529591d6fd96563ee021869b7c /py/objdeque.c | |
parent | 160d6708684de8c71895f90bc699a5879fb6ed29 (diff) |
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.
Diffstat (limited to 'py/objdeque.c')
-rw-r--r-- | py/objdeque.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/py/objdeque.c b/py/objdeque.c index 573a48baf..bbb078103 100644 --- a/py/objdeque.c +++ b/py/objdeque.c @@ -60,8 +60,7 @@ STATIC mp_obj_t deque_make_new(const mp_obj_type_t *type, size_t n_args, size_t o->base.type = type; o->alloc = maxlen + 1; o->i_get = o->i_put = 0; - o->items = m_new(mp_obj_t, o->alloc); - mp_seq_clear(o->items, 0, o->alloc, sizeof(*o->items)); + o->items = m_new0(mp_obj_t, o->alloc); if (n_args > 2) { o->flags = mp_obj_get_int(args[2]); |