Make it possible to pass "clojures" into hashtable_forall
This commit is contained in:
parent
43089c57de
commit
34f7eaea19
@ -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);
|
||||
}
|
||||
|
@ -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*);
|
||||
|
Loading…
Reference in New Issue
Block a user