* data data to associate with `key'
* allow_dup if nonzero, duplicate keys are allowed in the table
*/
-int hash_insert (HASH * table, const char *key, void *data, int allow_dup)
+int hash_insert (HASH * table, const char *key, const void *data, int allow_dup)
{
struct hash_elem *ptr;
int h;
mem_free (&pptr->table);
mem_free (ptr);
}
+
+void hash_map (HASH* table, void (*mapfunc) (const char* key, void* data,
+ unsigned long more),
+ unsigned long more) {
+ int i = 0;
+ struct hash_elem* elem = NULL;
+
+ if (!table || !mapfunc)
+ return;
+
+ for (i = 0; i < table->nelem; i++)
+ for (elem = table->table[i]; elem; elem = elem->next)
+ mapfunc (elem->key, elem->data, more);
+}