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
@@ -97,8 +97,7 @@ STATIC mp_obj_t webrepl_make_new(const mp_obj_type_t *type, size_t n_args, size_
|
||||
mp_arg_check_num(n_args, n_kw, 1, 2, false);
|
||||
mp_get_stream_raise(args[0], MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
|
||||
DEBUG_printf("sizeof(struct webrepl_file) = %lu\n", sizeof(struct webrepl_file));
|
||||
mp_obj_webrepl_t *o = m_new_obj(mp_obj_webrepl_t);
|
||||
o->base.type = type;
|
||||
mp_obj_webrepl_t *o = mp_obj_malloc(mp_obj_webrepl_t, type);
|
||||
o->sock = args[0];
|
||||
o->hdr_to_recv = sizeof(struct webrepl_file);
|
||||
o->data_to_recv = 0;
|
||||
|
||||
Reference in New Issue
Block a user