py/objdict: Make mp_obj_dict_get_map an inline function.
It's a very simple function and saves code, and improves efficiency, by being inline. Note that this is an auxiliary helper function and so doesn't need mp_check_self -- that's used for functions that can be accessed directly from Python code (eg from a method table).
This commit is contained in:
parent
3503f9626a
commit
d9cdb880ff
4
py/obj.h
4
py/obj.h
@ -758,7 +758,9 @@ size_t mp_obj_dict_len(mp_obj_t self_in);
|
|||||||
mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index);
|
mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index);
|
||||||
mp_obj_t mp_obj_dict_store(mp_obj_t self_in, mp_obj_t key, mp_obj_t value);
|
mp_obj_t mp_obj_dict_store(mp_obj_t self_in, mp_obj_t key, mp_obj_t value);
|
||||||
mp_obj_t mp_obj_dict_delete(mp_obj_t self_in, mp_obj_t key);
|
mp_obj_t mp_obj_dict_delete(mp_obj_t self_in, mp_obj_t key);
|
||||||
mp_map_t *mp_obj_dict_get_map(mp_obj_t self_in);
|
static inline mp_map_t *mp_obj_dict_get_map(mp_obj_t dict) {
|
||||||
|
return &((mp_obj_dict_t*)MP_OBJ_TO_PTR(dict))->map;
|
||||||
|
}
|
||||||
|
|
||||||
// set
|
// set
|
||||||
void mp_obj_set_store(mp_obj_t self_in, mp_obj_t item);
|
void mp_obj_set_store(mp_obj_t self_in, mp_obj_t item);
|
||||||
|
@ -600,9 +600,3 @@ mp_obj_t mp_obj_dict_delete(mp_obj_t self_in, mp_obj_t key) {
|
|||||||
dict_get_helper(2, args, MP_MAP_LOOKUP_REMOVE_IF_FOUND);
|
dict_get_helper(2, args, MP_MAP_LOOKUP_REMOVE_IF_FOUND);
|
||||||
return self_in;
|
return self_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_map_t *mp_obj_dict_get_map(mp_obj_t self_in) {
|
|
||||||
mp_check_self(MP_OBJ_IS_DICT_TYPE(self_in));
|
|
||||||
mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in);
|
|
||||||
return &self->map;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user