diff options
author | Damien George <damien.p.george@gmail.com> | 2015-11-27 17:01:44 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-11-29 14:25:35 +0000 |
commit | 999cedb90ff0827cdb9dfe0e4faa6ebc1739d271 (patch) | |
tree | 897eb07b82f1893cfd413b9ef7f625cd996f859d /unix/modos.c | |
parent | cbf7674025814797f5c537d6d1c195efe58ccaaf (diff) | |
download | micropython-999cedb90ff0827cdb9dfe0e4faa6ebc1739d271.tar.gz micropython-999cedb90ff0827cdb9dfe0e4faa6ebc1739d271.zip |
py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.
This allows the mp_obj_t type to be configured to something other than a
pointer-sized primitive type.
This patch also includes additional changes to allow the code to compile
when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of
mp_uint_t, and various casts.
Diffstat (limited to 'unix/modos.c')
-rw-r--r-- | unix/modos.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/unix/modos.c b/unix/modos.c index 3e8c5a6eb4..faf33dac9c 100644 --- a/unix/modos.c +++ b/unix/modos.c @@ -53,7 +53,7 @@ STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) { int res = stat(path, &sb); RAISE_ERRNO(res, errno); - mp_obj_tuple_t *t = mp_obj_new_tuple(10, NULL); + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.st_mode); t->items[1] = MP_OBJ_NEW_SMALL_INT(sb.st_ino); t->items[2] = MP_OBJ_NEW_SMALL_INT(sb.st_dev); @@ -64,7 +64,7 @@ STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) { t->items[7] = MP_OBJ_NEW_SMALL_INT(sb.st_atime); t->items[8] = MP_OBJ_NEW_SMALL_INT(sb.st_mtime); t->items[9] = MP_OBJ_NEW_SMALL_INT(sb.st_ctime); - return t; + return MP_OBJ_FROM_PTR(t); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_stat_obj, mod_os_stat); @@ -94,7 +94,7 @@ STATIC mp_obj_t mod_os_statvfs(mp_obj_t path_in) { int res = STATVFS(path, &sb); RAISE_ERRNO(res, errno); - mp_obj_tuple_t *t = mp_obj_new_tuple(10, NULL); + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.f_bsize); t->items[1] = MP_OBJ_NEW_SMALL_INT(sb.f_frsize); t->items[2] = MP_OBJ_NEW_SMALL_INT(sb.f_blocks); @@ -105,7 +105,7 @@ STATIC mp_obj_t mod_os_statvfs(mp_obj_t path_in) { t->items[7] = MP_OBJ_NEW_SMALL_INT(F_FAVAIL); t->items[8] = MP_OBJ_NEW_SMALL_INT(F_FLAG); t->items[9] = MP_OBJ_NEW_SMALL_INT(F_NAMEMAX); - return t; + return MP_OBJ_FROM_PTR(t); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_statvfs_obj, mod_os_statvfs); #endif |