# HG changeset patch # User Mike Becker # Date 1361957742 -3600 # Node ID 91595a45fad6ed12c089c4d5a14e26b175c1f5e3 # Parent ef3163857e882be7480ae06bfe20974c219cea9d added memcmp to the comparator module diff -r ef3163857e88 -r 91595a45fad6 ucx/comparator.c --- a/ucx/comparator.c Wed Feb 27 10:28:02 2013 +0100 +++ b/ucx/comparator.c Wed Feb 27 10:35:42 2013 +0100 @@ -25,3 +25,7 @@ return ptr1 < ptr2 ? -1 : 1; } } + +int ucx_memcmp(void *ptr1, void *ptr2, void *n) { + return memcmp(ptr1, ptr2, *((size_t*)n)); +} diff -r ef3163857e88 -r 91595a45fad6 ucx/comparator.h --- a/ucx/comparator.h Wed Feb 27 10:28:02 2013 +0100 +++ b/ucx/comparator.h Wed Feb 27 10:35:42 2013 +0100 @@ -47,6 +47,15 @@ */ int ucx_ptrcmp(void *ptr1, void *ptr2, void *data); +/** + * Compares two memory areas. + * @param ptr1 pointer one + * @param ptr2 pointer two + * @param n a pointer to the size_t containing the third parameter for memcmp + * @return the result of memcmp(ptr1, ptr2, *n) + */ +int ucx_memcmp(void *ptr1, void *ptr2, void *n); + #ifdef __cplusplus } #endif