diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2022-04-22 17:09:15 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-05-03 22:28:14 +1000 |
commit | 0e7bfc88c6ac6b5d64240f91183a3cfe2ab67ade (patch) | |
tree | b578372082eb5b661263d61a1194af3868968cf9 /py/modthread.c | |
parent | 6a3bc0e1a1f4dc0ad0b71ca0f168ad1a87d28859 (diff) |
all: Use mp_obj_malloc everywhere it's applicable.
This replaces occurences of
foo_t *foo = m_new_obj(foo_t);
foo->base.type = &foo_type;
with
foo_t *foo = mp_obj_malloc(foo_t, &foo_type);
Excludes any places where base is a sub-field or when new0/memset is used.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'py/modthread.c')
-rw-r--r-- | py/modthread.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/py/modthread.c b/py/modthread.c index 29b765493..d22b1854c 100644 --- a/py/modthread.c +++ b/py/modthread.c @@ -54,8 +54,7 @@ typedef struct _mp_obj_thread_lock_t { } mp_obj_thread_lock_t; STATIC mp_obj_thread_lock_t *mp_obj_new_thread_lock(void) { - mp_obj_thread_lock_t *self = m_new_obj(mp_obj_thread_lock_t); - self->base.type = &mp_type_thread_lock; + mp_obj_thread_lock_t *self = mp_obj_malloc(mp_obj_thread_lock_t, &mp_type_thread_lock); mp_thread_mutex_init(&self->mutex); self->locked = false; return self; |