cp_heap_push(3)
| cp_heap(3) | libcprops - cp_heap | cp_heap(3) |
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)
| JULY 2006 | libcprops.0.1.5 |
