Skip to content

Commit 65e26f4

Browse files
committed
py: mp_obj_get_type_qstr as macro saves 24 bytes
1 parent c0b3297 commit 65e26f4

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

py/obj.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in) {
5757
}
5858
}
5959

60-
qstr mp_obj_get_type_qstr(mp_const_obj_t o_in) {
61-
return mp_obj_get_type(o_in)->name;
62-
}
63-
6460
const char *mp_obj_get_type_str(mp_const_obj_t o_in) {
6561
return qstr_str(mp_obj_get_type_qstr(o_in));
6662
}

py/obj.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ mp_obj_t mp_obj_new_memoryview(byte typecode, size_t nitems, void *items);
680680

681681
mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in);
682682
const char *mp_obj_get_type_str(mp_const_obj_t o_in);
683-
qstr mp_obj_get_type_qstr(mp_const_obj_t o_in);
683+
#define mp_obj_get_type_qstr(o_in) (mp_obj_get_type((o_in))->name)
684684
bool mp_obj_is_subclass_fast(mp_const_obj_t object, mp_const_obj_t classinfo); // arguments should be type objects
685685
mp_obj_t mp_instance_cast_to_native_base(mp_obj_t self_in, mp_const_obj_t native_type);
686686

0 commit comments

Comments
 (0)