binsert.h File Reference

Functions


Function Documentation

void* binsert_g ( const void *  key,
void **  base,
size_t *  nel,
size_t  size,
int(*)(const void *, const void *)  compar 
)

Inserts an element into the table of elements at base.

If base is NULL, a new "table" is created, and a single element copied into it.

The memory of this table of elements will be reallocated if necessary.

How to call this function:

(void) binsert_g(&nr, (void **)&Table, &Nr_Elements, sizeof(int), intcompare);

Parameters:
key Pointer to the element to add
base Location of pointer to the table
nel Number of elements (will be incremented by this function)
size The size of each element in the table.
compar Comparison function (returns int, takes two pointers as arguments)
Returns:
Address of the (new) element

References cl_malloc(), cl_realloc(), and REALLOC_THRESHOLD.

Referenced by ComputeGroupInternally().


Generated on Sun Feb 28 18:08:03 2010 for CWB by  doxygen 1.6.1