mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 12:10:13 +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
@@ -417,8 +417,7 @@ mp_obj_t mp_vfs_ilistdir(size_t n_args, const mp_obj_t *args) {
|
||||
|
||||
if (vfs == MP_VFS_ROOT) {
|
||||
// list the root directory
|
||||
mp_vfs_ilistdir_it_t *iter = m_new_obj(mp_vfs_ilistdir_it_t);
|
||||
iter->base.type = &mp_type_polymorph_iter;
|
||||
mp_vfs_ilistdir_it_t *iter = mp_obj_malloc(mp_vfs_ilistdir_it_t, &mp_type_polymorph_iter);
|
||||
iter->iternext = mp_vfs_ilistdir_it_iternext;
|
||||
iter->cur.vfs = MP_STATE_VM(vfs_mount_table);
|
||||
iter->is_str = mp_obj_get_type(path_in) == &mp_type_str;
|
||||
|
||||
Reference in New Issue
Block a user