From 0e7bfc88c6ac6b5d64240f91183a3cfe2ab67ade Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Fri, 22 Apr 2022 17:09:15 +1000 Subject: 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 --- ports/unix/coverage.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'ports/unix/coverage.c') diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c index a85523720..7409221ef 100644 --- a/ports/unix/coverage.c +++ b/ports/unix/coverage.c @@ -639,14 +639,12 @@ STATIC mp_obj_t extra_coverage(void) { mp_printf(&mp_plat_print, "# end coverage.c\n"); - mp_obj_streamtest_t *s = m_new_obj(mp_obj_streamtest_t); - s->base.type = &mp_type_stest_fileio; + mp_obj_streamtest_t *s = mp_obj_malloc(mp_obj_streamtest_t, &mp_type_stest_fileio); s->buf = NULL; s->len = 0; s->pos = 0; s->error_code = 0; - mp_obj_streamtest_t *s2 = m_new_obj(mp_obj_streamtest_t); - s2->base.type = &mp_type_stest_textio2; + mp_obj_streamtest_t *s2 = mp_obj_malloc(mp_obj_streamtest_t, &mp_type_stest_textio2); // return a tuple of data for testing on the Python side mp_obj_t items[] = {(mp_obj_t)&str_no_hash_obj, (mp_obj_t)&bytes_no_hash_obj, MP_OBJ_FROM_PTR(s), MP_OBJ_FROM_PTR(s2)}; -- cgit v1.2.3