py: Simplify some cases of accessing the map of module and type dict.

mp_obj_module_get_globals() returns a mp_obj_dict_t*, and type->locals_dict
is a mp_obj_dict_t*, so access the map entry of the dict directly instead
of needing to cast this mp_obj_dict_t* up to an object and then calling the
mp_obj_dict_get_map() helper function.
This commit is contained in:
Damien George
2018-07-08 21:31:09 +10:00
parent 106e594580
commit a6ea6b08bc
2 changed files with 4 additions and 4 deletions

View File

@@ -1394,7 +1394,7 @@ void mp_import_all(mp_obj_t module) {
DEBUG_printf("import all %p\n", module);
// TODO: Support __all__
mp_map_t *map = mp_obj_dict_get_map(MP_OBJ_FROM_PTR(mp_obj_module_get_globals(module)));
mp_map_t *map = &mp_obj_module_get_globals(module)->map;
for (size_t i = 0; i < map->alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(map, i)) {
qstr name = MP_OBJ_QSTR_VALUE(map->table[i].key);