diff options
| author | Damien George | 2015-09-03 23:01:07 +0100 |
|---|---|---|
| committer | Damien George | 2015-09-03 23:01:07 +0100 |
| commit | 516982242df9eff369f5b2eb9e320f48ba19cdc2 (patch) | |
| tree | 5ce3587b97bde88fa09e01a0549a8e97194aadc9 /py/obj.c | |
| parent | 8bf00084b6385d497510d76226d01a47ed1f2924 (diff) | |
py: Inline single use of mp_obj_str_get_len in mp_obj_len_maybe.
Gets rid of redundant double check for string type.
Also remove obsolete declaration of mp_obj_str_get_hash.
Diffstat (limited to 'py/obj.c')
| -rw-r--r-- | py/obj.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -33,6 +33,7 @@ #include "py/obj.h" #include "py/objtype.h" #include "py/objint.h" +#include "py/objstr.h" #include "py/runtime0.h" #include "py/runtime.h" #include "py/stackctrl.h" @@ -422,7 +423,8 @@ mp_obj_t mp_obj_len_maybe(mp_obj_t o_in) { MP_OBJ_IS_STR(o_in) || #endif MP_OBJ_IS_TYPE(o_in, &mp_type_bytes)) { - return MP_OBJ_NEW_SMALL_INT(mp_obj_str_get_len(o_in)); + GET_STR_LEN(o_in, l); + return MP_OBJ_NEW_SMALL_INT(l); } else { mp_obj_type_t *type = mp_obj_get_type(o_in); if (type->unary_op != NULL) { |
