rcutils
master
C API providing common utilities and data structures.
|
#include "rcutils/macros.h"
#include "rcutils/types/rcutils_ret.h"
#include "rcutils/visibility_control.h"
Go to the source code of this file.
Functions | |
rcutils_ret_t | rcutils_qsort (void *ptr, size_t count, size_t size, int(*comp)(const void *, const void *)) |
Interface to qsort with rcutils-style argument validation. More... | |
rcutils_ret_t rcutils_qsort | ( | void * | ptr, |
size_t | count, | ||
size_t | size, | ||
int(*)(const void *, const void *) | comp | ||
) |
Interface to qsort with rcutils-style argument validation.
This function changes the order of the elements in the array so that they are in ascending order according to the given comparison function.
This function is thread-safe.
[in,out] | ptr | object whose elements should be sorted. |
[in] | count | number of elements present in the object. |
[in] | size | size of each element, in bytes. |
[in] | comp | function used to compare two elements. |
RCUTILS_RET_OK
if successful, or RCUTILS_RET_INVALID_ARGUMENT
for invalid arguments, or RCUTILS_RET_ERROR
if an unknown error occurs.