hashtable: keep track of entry count

This commit is contained in:
Matheus
2023-05-01 01:01:10 -03:00
parent ade8aa4e2b
commit 13982e15b7
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -63,6 +63,7 @@ int hashtable_set(hashtable_t *table, void *value, void *key, size_t keysize, bo
entry->keysize = keysize;
entry->hash = hash;
table->entries[tableoffset] = entry;
++table->entrycount;
return 0;
}
@@ -97,6 +98,7 @@ int hashtable_remove(hashtable_t *table, void *key, size_t keysize) {
free(entry->key);
slab_free(hashentrycache, entry);
--table->entrycount;
return 0;
}