all: Use mp_obj_malloc_with_finaliser everywhere it's applicable.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2024-02-16 11:02:58 +11:00
parent 4133c03040
commit cae690d047
19 changed files with 30 additions and 55 deletions

View File

@@ -105,8 +105,7 @@ STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, size_t n_ar
}
STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
machine_timer_obj_t *self = m_new_obj_with_finaliser(machine_timer_obj_t);
self->base.type = &machine_timer_type;
machine_timer_obj_t *self = mp_obj_malloc_with_finaliser(machine_timer_obj_t, &machine_timer_type);
self->pool = alarm_pool_get_default();
self->alarm_id = ALARM_ID_INVALID;

View File

@@ -145,8 +145,7 @@ STATIC mp_obj_t rp2_dma_make_new(const mp_obj_type_t *type, size_t n_args, size_
mp_raise_OSError(MP_EBUSY);
}
rp2_dma_obj_t *self = m_new_obj_with_finaliser(rp2_dma_obj_t);
self->base.type = &rp2_dma_type;
rp2_dma_obj_t *self = mp_obj_malloc_with_finaliser(rp2_dma_obj_t, &rp2_dma_type);
self->channel = dma_channel;
// Return the DMA object.