Libical API Documentation 4.0
|
An implementation of qsort that is more flexible than the version provided with stdlib. More...
Go to the source code of this file.
Functions | |
void | qsort_gen (void *list, size_t nitems, int(*compar)(const void *, size_t, size_t), void(*swapr)(void *, size_t, size_t)) |
Sort an arbitrary list of items using the qsort algorithm. interpreted by this function but passed to the compar and swapr functions. | |
void | qsort_gen_memswap (void *m1, void *m2, size_t size) |
Swaps two arbitrary blocks of memory. | |
An implementation of qsort that is more flexible than the version provided with stdlib.
In contrast to the qsort provided with stdlib, this version doesn't assume that the data to be sorted is stored in a contiguous block of memory.
void qsort_gen | ( | void * | list, |
size_t | nitems, | ||
int(* | compar )(const void *, size_t, size_t), | ||
void(* | swapr )(void *, size_t, size_t) ) |
Sort an arbitrary list of items using the qsort algorithm. interpreted by this function but passed to the compar and swapr functions.
nitems | The number of items in the list. |
compar | The comparator function. The function receives the pointer to the list to be sorted and the indices of the elements to be compared. |
swapr | The function used to swap two elements within the list. The function receives the pointer to the list to be sorted and the indices of the elements to be compared. |
void qsort_gen_memswap | ( | void * | m1, |
void * | m2, | ||
size_t | size ) |
Swaps two arbitrary blocks of memory.
m1 | Pointer to the first block of memory. |
m2 | Pointer to the second block of memory. |
size | Size of the memory blocks to be swapped. |