From 7ee0443fcd75c9438588f696154305cc3d35be21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Tue, 25 Oct 2016 15:51:52 +0200 Subject: [PATCH] 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. --- src/mapping.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mapping.c b/src/mapping.c index c12be9e684..2039457b60 100644 --- a/src/mapping.c +++ b/src/mapping.c @@ -692,6 +692,8 @@ struct mapping_data *copy_mapping_data(struct mapping_data *md) add_ref(nmd); /* For DMALLOC... */ nmd->valrefs=0; nmd->hardlinks=0; + nmd->ind_types = md->ind_types; + nmd->val_types = md->val_types; /* FIXME: What about nmd->flags? */ @@ -1185,6 +1187,10 @@ PMOD_EXPORT void map_delete_no_free(struct mapping *m, m->debug_size--; #endif + if (UNLIKELY(!md->size)) { + md->ind_types = md->val_types = 0; + } + if (!(md->flags & MAPPING_FLAG_NO_SHRINK)) { if((MAP_SLOTS(md->size) < md->hashsize * MIN_LINK_LENGTH) && (md->hashsize > AVG_LINK_LENGTH)) { -- GitLab