Skip to content
Snippets Groups Projects
Commit 7ee0443f authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Mappings: Update the type masks when emptying the mapping.

Fixes testsuite failure where two empty mappings weren't equal()
due to having non-overlapping type masks.
parent e4c9b64a
Branches
Tags
No related merge requests found
...@@ -692,6 +692,8 @@ struct mapping_data *copy_mapping_data(struct mapping_data *md) ...@@ -692,6 +692,8 @@ struct mapping_data *copy_mapping_data(struct mapping_data *md)
add_ref(nmd); /* For DMALLOC... */ add_ref(nmd); /* For DMALLOC... */
nmd->valrefs=0; nmd->valrefs=0;
nmd->hardlinks=0; nmd->hardlinks=0;
nmd->ind_types = md->ind_types;
nmd->val_types = md->val_types;
/* FIXME: What about nmd->flags? */ /* FIXME: What about nmd->flags? */
...@@ -1185,6 +1187,10 @@ PMOD_EXPORT void map_delete_no_free(struct mapping *m, ...@@ -1185,6 +1187,10 @@ PMOD_EXPORT void map_delete_no_free(struct mapping *m,
m->debug_size--; m->debug_size--;
#endif #endif
if (UNLIKELY(!md->size)) {
md->ind_types = md->val_types = 0;
}
if (!(md->flags & MAPPING_FLAG_NO_SHRINK)) { if (!(md->flags & MAPPING_FLAG_NO_SHRINK)) {
if((MAP_SLOTS(md->size) < md->hashsize * MIN_LINK_LENGTH) && if((MAP_SLOTS(md->size) < md->hashsize * MIN_LINK_LENGTH) &&
(md->hashsize > AVG_LINK_LENGTH)) { (md->hashsize > AVG_LINK_LENGTH)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment