The first patch is just a couple formatting fixes.
The second patch renames "nelem" to "bucket_count" to hopefully reduce
ambiguity.
The third patch adds a "elem_count" and increments/decrements it on
hash insert/remove.
The last patch is the main one, adding resize_hash(). I am not a hash
expert. If you have suggestions on the resizing limit, currently:
if (table->elem_count > table->bucket_count * 1.2)
resize_hash(table);
or other issues, please don't hesitate to mention them.
Kevin J. McCarthy (4):
Formatting cleanup in hash.c.
Rename hash nelem to bucket_count.
Add elem_count to hash.
Add resize_hash() function.
hash.c | 70 +++++++++++++++++++++++++++++++++++++++++++---------------
hash.h | 3 ++-
2 files changed, 54 insertions(+), 19 deletions(-)
--
2.55.0