summaryrefslogtreecommitdiff
path: root/extmod/vfs_fat_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/vfs_fat_file.c')
-rw-r--r--extmod/vfs_fat_file.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c
index 874f10c50..0d4af09b4 100644
--- a/extmod/vfs_fat_file.c
+++ b/extmod/vfs_fat_file.c
@@ -176,15 +176,17 @@ STATIC const mp_stream_p_t vfs_fat_fileio_stream_p = {
.ioctl = file_obj_ioctl,
};
-const mp_obj_type_t mp_type_vfs_fat_fileio = {
- { &mp_type_type },
- .name = MP_QSTR_FileIO,
- .print = file_obj_print,
- .getiter = mp_identity_getiter,
- .iternext = mp_stream_unbuffered_iter,
- .protocol = &vfs_fat_fileio_stream_p,
- .locals_dict = (mp_obj_dict_t *)&vfs_fat_rawfile_locals_dict,
-};
+MP_DEFINE_CONST_OBJ_TYPE(
+ mp_type_vfs_fat_fileio,
+ MP_QSTR_FileIO,
+ MP_TYPE_FLAG_NONE,
+ MP_TYPE_NULL_MAKE_NEW,
+ print, file_obj_print,
+ getiter, mp_identity_getiter,
+ iternext, mp_stream_unbuffered_iter,
+ protocol, &vfs_fat_fileio_stream_p,
+ locals_dict, (mp_obj_dict_t *)&vfs_fat_rawfile_locals_dict
+ );
STATIC const mp_stream_p_t vfs_fat_textio_stream_p = {
.read = file_obj_read,
@@ -193,15 +195,17 @@ STATIC const mp_stream_p_t vfs_fat_textio_stream_p = {
.is_text = true,
};
-const mp_obj_type_t mp_type_vfs_fat_textio = {
- { &mp_type_type },
- .name = MP_QSTR_TextIOWrapper,
- .print = file_obj_print,
- .getiter = mp_identity_getiter,
- .iternext = mp_stream_unbuffered_iter,
- .protocol = &vfs_fat_textio_stream_p,
- .locals_dict = (mp_obj_dict_t *)&vfs_fat_rawfile_locals_dict,
-};
+MP_DEFINE_CONST_OBJ_TYPE(
+ mp_type_vfs_fat_textio,
+ MP_QSTR_TextIOWrapper,
+ MP_TYPE_FLAG_NONE,
+ MP_TYPE_NULL_MAKE_NEW,
+ print, file_obj_print,
+ getiter, mp_identity_getiter,
+ iternext, mp_stream_unbuffered_iter,
+ protocol, &vfs_fat_textio_stream_p,
+ locals_dict, (mp_obj_dict_t *)&vfs_fat_rawfile_locals_dict
+ );
// Factory function for I/O stream classes
STATIC mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_in) {