#include "hash.h"
/* clears the hash */
-void hash_init(struct hashtable_t *hash)
+static void hash_init(struct hashtable_t *hash)
{
int i;
/* remove the hash structure. if hashdata_free_cb != NULL, this function will be
* called to remove the elements inside of the hash. if you don't remove the
* elements, memory might be leaked. */
-void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb)
+void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb, void *arg)
{
struct element_t *bucket, *last_bucket;
int i;
while (bucket != NULL) {
if (free_cb != NULL)
- free_cb(bucket->data);
+ free_cb(bucket->data, arg);
last_bucket = bucket;
bucket = bucket->next;
/* remove hash and eventual overflow buckets but not the content
* itself. */
- hash_delete(hash, NULL);
+ hash_delete(hash, NULL, NULL);
return new_hash;
}