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:
Jim Mussared
2022-04-22 17:09:15 +10:00
committed by Damien George
parent 6a3bc0e1a1
commit 0e7bfc88c6
105 changed files with 145 additions and 294 deletions

View File

@@ -57,8 +57,7 @@ STATIC esp32_partition_obj_t *esp32_partition_new(const esp_partition_t *part, u
if (part == NULL) {
mp_raise_OSError(MP_ENOENT);
}
esp32_partition_obj_t *self = m_new_obj(esp32_partition_obj_t);
self->base.type = &esp32_partition_type;
esp32_partition_obj_t *self = mp_obj_malloc(esp32_partition_obj_t, &esp32_partition_type);
self->part = part;
self->block_size = block_size;
if (self->block_size < NATIVE_BLOCK_SIZE_BYTES) {