heap.c
void
heap_foreach(heap* h, void (*func)(void *))
{
    // Store the current index and max index
    int index = 0;
    int entries = h->active_entries;

    heap_entry* entry;
    heap_entry* table = h->table;

    for (; index < entries; index++) {
        // Get the entry
        entry = GET_ENTRY(index, table);

        // Call the user function
        func(entry->val);
    }
}
/* Allows a user to iterate over all entries, e.g. to free() the memory */
Allows a user to iterate over all entries, e.g. to free() the memory
Allows a user to iterate over all entries e . g . to free () the memory
void
heap_foreach(heap* h, void (*func)(void *))
{
    int index = 0;
    int entries = h->active_entries;
    heap_entry* entry;
    heap_entry* table = h->table;
    for (; index < entries; index++) {
        entry = GET_ENTRY(index, table);
        func(entry->val);
    }
}
void heap_foreach ( heap * h , void ( * func ) ( void * ) ) { int index = 0 ; int entries = h -> active_entries ; heap_entry * entry ; heap_entry * table = h -> table ; for ( ; index < entries ; index ++ ) { entry = GET_ENTRY ( index , table ) ; func ( entry -> val ) ; } }
Allows a user to iterate over all entries, e.g.
Allows a user to iterate over all entries e . g .
// Store the current index and max index // Get the entry // Call the user function