aboutsummaryrefslogtreecommitdiff
path: root/py/obj.c
diff options
context:
space:
mode:
authorDamien George2015-09-03 23:01:07 +0100
committerDamien George2015-09-03 23:01:07 +0100
commit516982242df9eff369f5b2eb9e320f48ba19cdc2 (patch)
tree5ce3587b97bde88fa09e01a0549a8e97194aadc9 /py/obj.c
parent8bf00084b6385d497510d76226d01a47ed1f2924 (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.c4
1 files changed, 3 insertions, 1 deletions
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) {