diff options
author | Damien George <damien.p.george@gmail.com> | 2020-01-09 11:01:14 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-01-09 11:25:26 +1100 |
commit | bfbd94401d9cf658fc50b2e45896aba300a7af71 (patch) | |
tree | 21aec2207f432658083a26ed5172f9ce0e57ee43 /py/nativeglue.h | |
parent | e3187b052f14872fdb5e2d2338d359013a544fae (diff) |
py: Make mp_obj_get_type() return a const ptr to mp_obj_type_t.
Most types are in rodata/ROM, and mp_obj_base_t.type is a constant pointer,
so enforce this const-ness throughout the code base. If a type ever needs
to be modified (eg a user type) then a simple cast can be used.
Diffstat (limited to 'py/nativeglue.h')
-rw-r--r-- | py/nativeglue.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/nativeglue.h b/py/nativeglue.h index 021e7a8ec..1b6d9cc7a 100644 --- a/py/nativeglue.h +++ b/py/nativeglue.h @@ -146,7 +146,7 @@ typedef struct _mp_fun_table_t { NORETURN // Only certain compilers support no-return attributes in function pointer declarations #endif void (*raise_msg)(const mp_obj_type_t *exc_type, const char *msg); - mp_obj_type_t *(*obj_get_type)(mp_const_obj_t o_in); + const mp_obj_type_t *(*obj_get_type)(mp_const_obj_t o_in); mp_obj_t (*obj_new_str)(const char* data, size_t len); mp_obj_t (*obj_new_bytes)(const byte* data, size_t len); mp_obj_t (*obj_new_bytearray_by_ref)(size_t n, void *items); |