summaryrefslogtreecommitdiff
path: root/extmod/vfs_fat.c
diff options
context:
space:
mode:
authorJon Foster <jon@jon-foster.co.uk>2024-04-01 19:23:49 +0100
committerDamien George <damien@micropython.org>2024-07-04 15:55:03 +1000
commit92484d8822635c125a7648d5b056ff7f78d62ab3 (patch)
tree34f8731d56f4330fe0e8a0ca325cdedd8e2eaa8a /extmod/vfs_fat.c
parent289b2dd87960a4cdf019013cecd489f0d0cabc26 (diff)
all: Use new mp_obj_new_str_from_cstr() function.
Use new function mp_obj_new_str_from_cstr() where appropriate. It simplifies the code, and makes it smaller too. Signed-off-by: Jon Foster <jon@jon-foster.co.uk>
Diffstat (limited to 'extmod/vfs_fat.c')
-rw-r--r--extmod/vfs_fat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c
index 38c166336..4f01432f5 100644
--- a/extmod/vfs_fat.c
+++ b/extmod/vfs_fat.c
@@ -144,7 +144,7 @@ static mp_obj_t mp_vfs_fat_ilistdir_it_iternext(mp_obj_t self_in) {
// make 4-tuple with info about this entry
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(4, NULL));
if (self->is_str) {
- t->items[0] = mp_obj_new_str(fn, strlen(fn));
+ t->items[0] = mp_obj_new_str_from_cstr(fn);
} else {
t->items[0] = mp_obj_new_bytes((const byte *)fn, strlen(fn));
}
@@ -291,7 +291,7 @@ static mp_obj_t fat_vfs_getcwd(mp_obj_t vfs_in) {
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
- return mp_obj_new_str(buf, strlen(buf));
+ return mp_obj_new_str_from_cstr(buf);
}
static MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getcwd_obj, fat_vfs_getcwd);