summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/vfs_lfsx_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/vfs_lfsx_file.c')
-rw-r--r--extmod/vfs_lfsx_file.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/extmod/vfs_lfsx_file.c b/extmod/vfs_lfsx_file.c
index 124361feb9..ba90cc6084 100644
--- a/extmod/vfs_lfsx_file.c
+++ b/extmod/vfs_lfsx_file.c
@@ -220,15 +220,17 @@ STATIC const mp_stream_p_t MP_VFS_LFSx(fileio_stream_p) = {
.ioctl = MP_VFS_LFSx(file_ioctl),
};
-const mp_obj_type_t MP_TYPE_VFS_LFSx_(_fileio) = {
- { &mp_type_type },
- .name = MP_QSTR_FileIO,
- .print = MP_VFS_LFSx(file_print),
- .getiter = mp_identity_getiter,
- .iternext = mp_stream_unbuffered_iter,
- .protocol = &MP_VFS_LFSx(fileio_stream_p),
- .locals_dict = (mp_obj_dict_t *)&MP_VFS_LFSx(file_locals_dict),
-};
+MP_DEFINE_CONST_OBJ_TYPE(
+ MP_TYPE_VFS_LFSx_(_fileio),
+ MP_QSTR_FileIO,
+ MP_TYPE_FLAG_NONE,
+ MP_TYPE_NULL_MAKE_NEW,
+ print, MP_VFS_LFSx(file_print),
+ getiter, mp_identity_getiter,
+ iternext, mp_stream_unbuffered_iter,
+ protocol, &MP_VFS_LFSx(fileio_stream_p),
+ locals_dict, (mp_obj_dict_t *)&MP_VFS_LFSx(file_locals_dict)
+ );
STATIC const mp_stream_p_t MP_VFS_LFSx(textio_stream_p) = {
.read = MP_VFS_LFSx(file_read),
@@ -237,12 +239,14 @@ STATIC const mp_stream_p_t MP_VFS_LFSx(textio_stream_p) = {
.is_text = true,
};
-const mp_obj_type_t MP_TYPE_VFS_LFSx_(_textio) = {
- { &mp_type_type },
- .name = MP_QSTR_TextIOWrapper,
- .print = MP_VFS_LFSx(file_print),
- .getiter = mp_identity_getiter,
- .iternext = mp_stream_unbuffered_iter,
- .protocol = &MP_VFS_LFSx(textio_stream_p),
- .locals_dict = (mp_obj_dict_t *)&MP_VFS_LFSx(file_locals_dict),
-};
+MP_DEFINE_CONST_OBJ_TYPE(
+ MP_TYPE_VFS_LFSx_(_textio),
+ MP_QSTR_TextIOWrapper,
+ MP_TYPE_FLAG_NONE,
+ MP_TYPE_NULL_MAKE_NEW,
+ print, MP_VFS_LFSx(file_print),
+ getiter, mp_identity_getiter,
+ iternext, mp_stream_unbuffered_iter,
+ protocol, &MP_VFS_LFSx(textio_stream_p),
+ locals_dict, (mp_obj_dict_t *)&MP_VFS_LFSx(file_locals_dict)
+ );