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 /extmod/moduzlib.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 'extmod/moduzlib.c')
-rw-r--r-- | extmod/moduzlib.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index a6874fb4e..d02404f1c 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -69,8 +69,7 @@ STATIC int read_src_stream(TINF_DATA *data) { STATIC mp_obj_t decompio_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 2, false); mp_get_stream_raise(args[0], MP_STREAM_OP_READ); - mp_obj_decompio_t *o = m_new_obj(mp_obj_decompio_t); - o->base.type = type; + mp_obj_decompio_t *o = mp_obj_malloc(mp_obj_decompio_t, type); memset(&o->decomp, 0, sizeof(o->decomp)); o->decomp.readSource = read_src_stream; o->src_stream = args[0]; |