static void destroy_heap( const char *name, object_heap_p heap, destroy_heap_func_t destroy_func, void *user_data ) { object_base_p obj; object_heap_iterator iter; if (!heap) return; obj = object_heap_first(heap, &iter); while (obj) { xvba_information_message("vaTerminate(): %s ID 0x%08x is still allocated, destroying\n", name, obj->id); if (destroy_func) destroy_func(obj, user_data); else object_heap_free(heap, obj); obj = object_heap_next(heap, &iter); } object_heap_destroy(heap); }
static VOID media_destroy_heap (struct object_heap *heap, VOID (*func) (struct object_heap * heap, struct object_base * object)) { struct object_base *object; object_heap_iterator iter; object = object_heap_first (heap, &iter); while (object) { if (func) func (heap, object); object = object_heap_next (heap, &iter); } object_heap_destroy (heap); }
/* * Iterate over all objects in the heap. * Returns a pointer to the first object on the heap, returns NULL if heap is empty. */ object_base_p object_heap_first( object_heap_p heap, object_heap_iterator *iter ) { *iter = -1; return object_heap_next( heap, iter ); }