mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +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
@@ -302,8 +302,7 @@ STATIC mp_obj_t pyb_flash_make_new(const mp_obj_type_t *type, size_t n_args, siz
|
||||
return MP_OBJ_FROM_PTR(&pyb_flash_obj);
|
||||
}
|
||||
|
||||
pyb_flash_obj_t *self = m_new_obj(pyb_flash_obj_t);
|
||||
self->base.type = &pyb_flash_type;
|
||||
pyb_flash_obj_t *self = mp_obj_malloc(pyb_flash_obj_t, &pyb_flash_type);
|
||||
self->use_native_block_size = false;
|
||||
|
||||
uint32_t bl_len = (storage_get_block_count() - FLASH_PART1_START_BLOCK) * FLASH_BLOCK_SIZE;
|
||||
|
||||
Reference in New Issue
Block a user