Skip to content

Commit 2942430

Browse files
committed
unix: Use mp_obj_str_get_str instead of mp_obj_str_get_data.
1 parent ab5689b commit 2942430

3 files changed

Lines changed: 5 additions & 10 deletions

File tree

unix/modffi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ STATIC ffi_type *char2ffi_type(char c)
126126
STATIC ffi_type *get_ffi_type(mp_obj_t o_in)
127127
{
128128
if (MP_OBJ_IS_STR(o_in)) {
129-
mp_uint_t len;
130-
const char *s = mp_obj_str_get_data(o_in, &len);
129+
const char *s = mp_obj_str_get_str(o_in);
131130
ffi_type *t = char2ffi_type(*s);
132131
if (t != NULL) {
133132
return t;

unix/modos.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646

4747
STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) {
4848
struct stat sb;
49-
mp_uint_t len;
50-
const char *path = mp_obj_str_get_data(path_in, &len);
49+
const char *path = mp_obj_str_get_str(path_in);
5150

5251
int res = stat(path, &sb);
5352
RAISE_ERRNO(res, errno);
@@ -87,8 +86,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_stat_obj, mod_os_stat);
8786

8887
STATIC mp_obj_t mod_os_statvfs(mp_obj_t path_in) {
8988
STRUCT_STATVFS sb;
90-
mp_uint_t len;
91-
const char *path = mp_obj_str_get_data(path_in, &len);
89+
const char *path = mp_obj_str_get_str(path_in);
9290

9391
int res = STATVFS(path, &sb);
9492
RAISE_ERRNO(res, errno);
@@ -110,8 +108,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_statvfs_obj, mod_os_statvfs);
110108
#endif
111109

112110
STATIC mp_obj_t mod_os_unlink(mp_obj_t path_in) {
113-
mp_uint_t len;
114-
const char *path = mp_obj_str_get_data(path_in, &len);
111+
const char *path = mp_obj_str_get_str(path_in);
115112

116113
int r = unlink(path);
117114

unix/modtermios.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ STATIC mp_obj_t mod_termios_tcsetattr(mp_obj_t fd_in, mp_obj_t when_in, mp_obj_t
9090
if (i == VMIN || i == VTIME) {
9191
term.c_cc[i] = mp_obj_get_int(cc->items[i]);
9292
} else {
93-
mp_uint_t len;
94-
term.c_cc[i] = *mp_obj_str_get_data(cc->items[i], &len);
93+
term.c_cc[i] = *mp_obj_str_get_str(cc->items[i]);
9594
}
9695
}
9796

0 commit comments

Comments
 (0)