Skip to content

Commit

Permalink
py/objfloat: Explain why mp_obj_malloc isn't used.
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Mussared <[email protected]>
  • Loading branch information
jimmo authored and dpgeorge committed May 3, 2022
1 parent 709e832 commit 6a3bc0e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion py/objfloat.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ const mp_obj_type_t mp_type_float = {
#if MICROPY_OBJ_REPR != MICROPY_OBJ_REPR_C && MICROPY_OBJ_REPR != MICROPY_OBJ_REPR_D

mp_obj_t mp_obj_new_float(mp_float_t value) {
mp_obj_float_t *o = m_new(mp_obj_float_t, 1);
// Don't use mp_obj_malloc here to avoid extra function call overhead.
mp_obj_float_t *o = m_new_obj(mp_obj_float_t);
o->base.type = &mp_type_float;
o->value = value;
return MP_OBJ_FROM_PTR(o);
Expand Down

0 comments on commit 6a3bc0e

Please sign in to comment.