summaryrefslogtreecommitdiff
path: root/py/objarray.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-04-22 17:09:15 +1000
committerDamien George <damien@micropython.org>2022-05-03 22:28:14 +1000
commit0e7bfc88c6ac6b5d64240f91183a3cfe2ab67ade (patch)
treeb578372082eb5b661263d61a1194af3868968cf9 /py/objarray.c
parent6a3bc0e1a1f4dc0ad0b71ca0f168ad1a87d28859 (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/objarray.c')
-rw-r--r--py/objarray.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/py/objarray.c b/py/objarray.c
index 16a4d4aac..bff3126a2 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -639,8 +639,7 @@ mp_obj_t mp_obj_new_bytearray(size_t n, void *items) {
// Create bytearray which references specified memory area
mp_obj_t mp_obj_new_bytearray_by_ref(size_t n, void *items) {
- mp_obj_array_t *o = m_new_obj(mp_obj_array_t);
- o->base.type = &mp_type_bytearray;
+ mp_obj_array_t *o = mp_obj_malloc(mp_obj_array_t, &mp_type_bytearray);
o->typecode = BYTEARRAY_TYPECODE;
o->free = 0;
o->len = n;