mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 04:00:28 +01:00
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>
This commit is contained in:
committed by
Damien George
parent
6a3bc0e1a1
commit
0e7bfc88c6
@@ -47,8 +47,7 @@ STATIC mp_obj_t reversed_make_new(const mp_obj_type_t *type, size_t n_args, size
|
||||
return mp_call_method_n_kw(0, 0, dest);
|
||||
}
|
||||
|
||||
mp_obj_reversed_t *o = m_new_obj(mp_obj_reversed_t);
|
||||
o->base.type = type;
|
||||
mp_obj_reversed_t *o = mp_obj_malloc(mp_obj_reversed_t, type);
|
||||
o->seq = args[0];
|
||||
o->cur_index = mp_obj_get_int(mp_obj_len(args[0])); // start at the end of the sequence
|
||||
|
||||
|
||||
Reference in New Issue
Block a user