Function rcutils_qsort

Function Documentation

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.

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.

Parameters:
  • ptr[inout] object whose elements should be sorted.

  • count[in] number of elements present in the object.

  • size[in] size of each element, in bytes.

  • comp[in] function used to compare two elements.

Returns:

RCUTILS_RET_OK if successful, or

Returns:

RCUTILS_RET_INVALID_ARGUMENT for invalid arguments, or

Returns:

RCUTILS_RET_ERROR if an unknown error occurs.