diff options
author | Damien George <damien.p.george@gmail.com> | 2019-01-30 18:49:52 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-02-12 14:54:51 +1100 |
commit | eee1e8841a852f374b83e0a3e3b0ff7b66e54243 (patch) | |
tree | c928ad701fc0df71dc2863178ea8d2e8bea4946b /py/persistentcode.c | |
parent | 019433a17e82f22e8ee24ad1b53156403d4f4a67 (diff) |
py: Downcase all MP_OBJ_IS_xxx macros to make a more consistent C API.
These macros could in principle be (inline) functions so it makes sense to
have them lower case, to match the other C API functions.
The remaining macros that are upper case are:
- MP_OBJ_TO_PTR, MP_OBJ_FROM_PTR
- MP_OBJ_NEW_SMALL_INT, MP_OBJ_SMALL_INT_VALUE
- MP_OBJ_NEW_QSTR, MP_OBJ_QSTR_VALUE
- MP_OBJ_FUN_MAKE_SIG
- MP_DECLARE_CONST_xxx
- MP_DEFINE_CONST_xxx
These must remain macros because they are used when defining const data (at
least, MP_OBJ_NEW_SMALL_INT is so it makes sense to have
MP_OBJ_SMALL_INT_VALUE also a macro).
For those macros that have been made lower case, compatibility macros are
provided for the old names so that users do not need to change their code
immediately.
Diffstat (limited to 'py/persistentcode.c')
-rw-r--r-- | py/persistentcode.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/py/persistentcode.c b/py/persistentcode.c index 88e958d8f..aff37036b 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -272,9 +272,9 @@ STATIC void save_qstr(mp_print_t *print, qstr qst) { } STATIC void save_obj(mp_print_t *print, mp_obj_t o) { - if (MP_OBJ_IS_STR_OR_BYTES(o)) { + if (mp_obj_is_str_or_bytes(o)) { byte obj_type; - if (MP_OBJ_IS_STR(o)) { + if (mp_obj_is_str(o)) { obj_type = 's'; } else { obj_type = 'b'; @@ -291,10 +291,10 @@ STATIC void save_obj(mp_print_t *print, mp_obj_t o) { // we save numbers using a simplistic text representation // TODO could be improved byte obj_type; - if (MP_OBJ_IS_TYPE(o, &mp_type_int)) { + if (mp_obj_is_type(o, &mp_type_int)) { obj_type = 'i'; #if MICROPY_PY_BUILTINS_COMPLEX - } else if (MP_OBJ_IS_TYPE(o, &mp_type_complex)) { + } else if (mp_obj_is_type(o, &mp_type_complex)) { obj_type = 'c'; #endif } else { |