Change the resize check from "count > size" to "count >= size" to avoid a
potential infinite loop with high load factors and a full hash table.
unsigned long h, n;
t->inserts++;
- if(t->count > t->size * 0.66) lh_table_resize(t, t->size * 2);
+ if(t->count >= t->size * LH_LOAD_FACTOR) lh_table_resize(t, t->size * 2);
h = t->hash_fn(k);
n = h % t->size;
*/
#define LH_PRIME 0x9e370001UL
+/**
+ * The fraction of filled hash buckets until an insert will cause the table
+ * to be resized.
+ * This can range from just above 0 up to 1.0.
+ */
+#define LH_LOAD_FACTOR 0.66
+
/**
* sentinel pointer value for empty slots
*/