cp_heap

Section: libcprops - cp_heap (3)
Updated: JULY 2006
Index Return to Main Contents
 

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)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 10:58:20 GMT, July 29, 2006