Change memory allocation API to require size for free and realloc.

This commit is contained in:
Damien
2013-12-29 19:33:23 +00:00
parent a1c8e5737c
commit 732407f1bf
22 changed files with 57 additions and 52 deletions

View File

@@ -64,7 +64,7 @@ mp_map_elem_t* mp_map_lookup_helper(mp_map_t *map, mp_obj_t index, bool add_if_n
mp_map_lookup_helper(map, old_table[i].key, true)->value = old_table[i].value;
}
}
m_free(old_table);
m_del(mp_map_elem_t, old_table, old_alloc);
// restart the search for the new element
pos = hash % map->alloc;
} else {
@@ -124,7 +124,7 @@ mp_obj_t mp_set_lookup(mp_set_t *set, mp_obj_t index, bool add_if_not_found) {
mp_set_lookup(set, old_table[i], true);
}
}
m_free(old_table);
m_del(mp_obj_t, old_table, old_alloc);
// restart the search for the new element
pos = hash % set->alloc;
} else {