mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 12:40:15 +01:00
py/obj: Change sizeof to offsetof in mp_obj_malloc_var macro.
Following b6a9778484, to properly calculate
the size of the variable-length allocation.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -38,7 +38,7 @@ typedef struct _mp_obj_map_t {
|
||||
|
||||
STATIC mp_obj_t map_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 2, MP_OBJ_FUN_ARGS_MAX, false);
|
||||
mp_obj_map_t *o = mp_obj_malloc_var(mp_obj_map_t, mp_obj_t, n_args - 1, type);
|
||||
mp_obj_map_t *o = mp_obj_malloc_var(mp_obj_map_t, iters, mp_obj_t, n_args - 1, type);
|
||||
o->n_iters = n_args - 1;
|
||||
o->fun = args[0];
|
||||
for (size_t i = 0; i < n_args - 1; i++) {
|
||||
|
||||
Reference in New Issue
Block a user