Make it possible to pass "clojures" into hashtable_forall

This commit is contained in:
bʰedoh₂ swé 2024-07-29 15:11:21 +05:00
parent 43089c57de
commit 34f7eaea19
2 changed files with 3 additions and 3 deletions

View File

@ -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);
}

View File

@ -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*);