Skip to content

Fix two bugs found in the CHashMap

Jeremy Soller requested to merge bricehulse:master into master

Created by: bricehulse

These are fixes for two issues I ran into using CHashMap:

  1. If you use alter() to change the value for a key that already exists in the map, the len field gets incremented, even though it should stay the same.

  2. If you do a bunch of alternating insertions and removals, you can end up with a situation where every single bucket is either used or "free" (i.e. none of them are "empty"). If you try to insert another entry when this is a case, it goes into an infinite loop when it looks for a bucket to place the new entry in, because it expects to find an "empty" bucket at the end of the cluster, but there are no empty buckets.

Merge request reports