summaryrefslogtreecommitdiff
path: root/extmod/vfs_fat_file.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2021-07-14 14:38:38 +1000
committerDamien George <damien@micropython.org>2022-09-19 19:06:01 +1000
commit662b9761b37b054f08fe2f7c00d0fce3a418d0b0 (patch)
tree3ab168faeb26685d511bf47caa21d2eabdd86c69 /extmod/vfs_fat_file.c
parentcdb880789f61ee037cc7905ad75a7a9201d12ba5 (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 '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) {