summaryrefslogtreecommitdiff
path: root/extmod/modframebuf.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-04-22 17:09:15 +1000
committerDamien George <damien@micropython.org>2022-05-03 22:28:14 +1000
commit0e7bfc88c6ac6b5d64240f91183a3cfe2ab67ade (patch)
treeb578372082eb5b661263d61a1194af3868968cf9 /extmod/modframebuf.c
parent6a3bc0e1a1f4dc0ad0b71ca0f168ad1a87d28859 (diff)
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>
Diffstat (limited to 'extmod/modframebuf.c')
-rw-r--r--extmod/modframebuf.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c
index 454624dda..27e9c3625 100644
--- a/extmod/modframebuf.c
+++ b/extmod/modframebuf.c
@@ -266,8 +266,7 @@ STATIC void fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, u
STATIC mp_obj_t framebuf_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, 4, 5, false);
- mp_obj_framebuf_t *o = m_new_obj(mp_obj_framebuf_t);
- o->base.type = type;
+ mp_obj_framebuf_t *o = mp_obj_malloc(mp_obj_framebuf_t, type);
o->buf_obj = args[0];
mp_buffer_info_t bufinfo;
@@ -628,8 +627,7 @@ STATIC const mp_obj_type_t mp_type_framebuf = {
// this factory function is provided for backwards compatibility with old FrameBuffer1 class
STATIC mp_obj_t legacy_framebuffer1(size_t n_args, const mp_obj_t *args) {
- mp_obj_framebuf_t *o = m_new_obj(mp_obj_framebuf_t);
- o->base.type = &mp_type_framebuf;
+ mp_obj_framebuf_t *o = mp_obj_malloc(mp_obj_framebuf_t, &mp_type_framebuf);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_WRITE);