diff --git a/hashtable.c b/hashtable.c index a4025be..244b453 100644 --- a/hashtable.c +++ b/hashtable.c @@ -106,9 +106,9 @@ bool hashtable_delete(hashtable* table, char* name) { return false; } -void hashtable_forall(hashtable* table, void (*callback)(char*, void*)) { +void hashtable_forall(hashtable* table, void (*callback)(char*, void*, void*), void* userdata) { size_t capacity = table->capacity; hashtable_item* items = table->items; for (size_t i = 0; i < capacity; i++) - callback(items[i].name, items[i].data); + callback(items[i].name, items[i].data, userdata); } diff --git a/hashtable.h b/hashtable.h index 967b735..b866665 100644 --- a/hashtable.h +++ b/hashtable.h @@ -33,4 +33,4 @@ void hashtable_set(hashtable* table, char* name, void* data); bool hashtable_delete(hashtable*, char*); -void hashtable_forall(hashtable*, void (*)(char*, void*)); +void hashtable_forall(hashtable*, void (*)(char*, void*, void*), void*);