Reset threshold after clearing Hash

The old behavior could lead to premature resizing of hash tables after a
Clear operation.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/93f0dee1
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/93f0dee1
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/93f0dee1

Branch: refs/heads/master
Commit: 93f0dee1f8c8e9ff8cb5f576ff71b4c0d0470594
Parents: 0b74633
Author: Nick Wellnhofer <[email protected]>
Authored: Tue Apr 14 12:59:57 2015 +0200
Committer: Nick Wellnhofer <[email protected]>
Committed: Wed Apr 15 15:22:09 2015 +0200

----------------------------------------------------------------------
 runtime/core/Clownfish/Hash.c | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/93f0dee1/runtime/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Hash.c b/runtime/core/Clownfish/Hash.c
index 7a4a450..c46b9ea 100644
--- a/runtime/core/Clownfish/Hash.c
+++ b/runtime/core/Clownfish/Hash.c
@@ -112,6 +112,8 @@ Hash_Clear_IMP(Hash *self) {
     }
 
     self->size = 0;
+    // All tombstones were removed, reset threshold.
+    self->threshold = (self->capacity / 3) * 2;
 }
 
 void

Reply via email to