From 516982242df9eff369f5b2eb9e320f48ba19cdc2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Sep 2015 23:01:07 +0100 Subject: 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. --- py/obj.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'py/obj.c') diff --git a/py/obj.c b/py/obj.c index 555a4a8b9..34ecdab84 100644 --- a/py/obj.c +++ b/py/obj.c @@ -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) { -- cgit v1.2.3