diff -r 22257f6d06a3 -r bc782cca0759 ucx/cx/compare.h --- a/ucx/cx/compare.h Thu May 23 23:19:06 2024 +0200 +++ b/ucx/cx/compare.h Thu May 23 23:23:36 2024 +0200 @@ -30,7 +30,6 @@ * \brief A collection of simple compare functions. * \author Mike Becker * \author Olaf Wintermann - * \version 3.0 * \copyright 2-Clause BSD License */ @@ -43,6 +42,17 @@ extern "C" { #endif +#ifndef CX_COMPARE_FUNC_DEFINED +#define CX_COMPARE_FUNC_DEFINED +/** + * A comparator function comparing two collection elements. + */ +typedef int(*cx_compare_func)( + void const *left, + void const *right +); +#endif // CX_COMPARE_FUNC_DEFINED + /** * Compares two integers of type int. * @@ -213,6 +223,19 @@ void const *ptr2 ); +/** + * Compares the pointers specified in the arguments without de-referencing. + * + * @param ptr1 pointer one + * @param ptr2 pointer two + * @return -1 if ptr1 is less than ptr2, 0 if both are equal, + * 1 if ptr1 is greater than ptr2 + */ +int cx_cmp_ptr( + void const *ptr1, + void const *ptr2 +); + #ifdef __cplusplus } // extern "C" #endif