cp_heap_pop(3) - Linux man page

Name

cp_heap_push, cp_heap_pop - push / pop an item on / from a heap

Synopsis

#include <cprops/heap.h>

void *cp_heap_push(cp_heap *heap, void *item);
void *cp_heap_pop(cp_heap *heap);

Description

cp_heap_push inserts the given item to the heap. If COLLECTION_MODE_COPY is set and the heap was initialized with a non-null copy function, the copy of the item obtained by invoking the copy function is inserted rather than the item itself.

cp_heap_pop returns the minimum item from the heap as determined using the heap compare function set at initialization. If the COLLECTION_MODE_DEEP mode bit is set and the heap was initialized with a non-null item destructor function, the destructor function in called on the item being removed.

Return Value

cp_heap_push returns the affected item on success or NULL on allocation failure.

cp_heap_pop returns the minimum item or NULL if the heap is empty.

See Also

cp_heap_create(3), cp_heap_set_mode(3)

Referenced By

cp_heap(3), cp_heap_destroy(3)