diff options
| author | Jim Mussared <jim.mussared@gmail.com> | 2021-07-14 14:38:38 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-09-19 19:06:01 +1000 |
| commit | 662b9761b37b054f08fe2f7c00d0fce3a418d0b0 (patch) | |
| tree | 3ab168faeb26685d511bf47caa21d2eabdd86c69 /ports/unix/coverage.c | |
| parent | cdb880789f61ee037cc7905ad75a7a9201d12ba5 (diff) | |
all: Make all mp_obj_type_t defs use MP_DEFINE_CONST_OBJ_TYPE.
In preparation for upcoming rework of mp_obj_type_t layout.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'ports/unix/coverage.c')
| -rw-r--r-- | ports/unix/coverage.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c index cf425ac43..b4567417a 100644 --- a/ports/unix/coverage.c +++ b/ports/unix/coverage.c @@ -106,11 +106,14 @@ STATIC const mp_stream_p_t fileio_stream_p = { .ioctl = stest_ioctl, }; -STATIC const mp_obj_type_t mp_type_stest_fileio = { - { &mp_type_type }, - .protocol = &fileio_stream_p, - .locals_dict = (mp_obj_dict_t *)&rawfile_locals_dict, -}; +STATIC MP_DEFINE_CONST_OBJ_TYPE( + mp_type_stest_fileio, + MP_QSTR_stest_fileio, + MP_TYPE_FLAG_NONE, + MP_TYPE_NULL_MAKE_NEW, + protocol, &fileio_stream_p, + locals_dict, (mp_obj_dict_t *)&rawfile_locals_dict + ); // stream read returns non-blocking error STATIC mp_uint_t stest_read2(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) { @@ -133,11 +136,14 @@ STATIC const mp_stream_p_t textio_stream_p2 = { .is_text = true, }; -STATIC const mp_obj_type_t mp_type_stest_textio2 = { - { &mp_type_type }, - .protocol = &textio_stream_p2, - .locals_dict = (mp_obj_dict_t *)&rawfile_locals_dict2, -}; +STATIC MP_DEFINE_CONST_OBJ_TYPE( + mp_type_stest_textio2, + MP_QSTR_stest_textio2, + MP_TYPE_FLAG_NONE, + MP_TYPE_NULL_MAKE_NEW, + protocol, &textio_stream_p2, + locals_dict, (mp_obj_dict_t *)&rawfile_locals_dict2 + ); // str/bytes objects without a valid hash STATIC const mp_obj_str_t str_no_hash_obj = {{&mp_type_str}, 0, 10, (const byte *)"0123456789"}; |
