CWB
Functions

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:
keyPointer to the element to add
baseLocation of pointer to the table
nelNumber of elements (will be incremented by this function)
sizeThe size of each element in the table.
comparComparison 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().