# HG changeset patch # User Mike Becker # Date 1526055234 -7200 # Node ID d9abf53b83979b41a6ce9c73f8d53b3d5c7b5bd5 # Parent deb0035635ebdfd60d186f3ac66dd1d91b3a14b5 adds ucx_sstrcmp() compare function to utils.h diff -r deb0035635eb -r d9abf53b8397 src/ucx/utils.h --- a/src/ucx/utils.h Fri May 11 17:40:16 2018 +0200 +++ b/src/ucx/utils.h Fri May 11 18:13:54 2018 +0200 @@ -156,6 +156,15 @@ int ucx_strncmp(const void *s1, const void *s2, void *n); /** + * Wraps the sstrcmp function. + * @param s1 sstr one + * @param s2 sstr two + * @param data ignored + * @return the result of sstrcmp(s1, s2) + */ +int ucx_sstrcmp(const void *s1, const void *s2, void *data); + +/** * Compares two integers of type int. * @param i1 pointer to integer one * @param i2 pointer to integer two diff -r deb0035635eb -r d9abf53b8397 src/utils.c --- a/src/utils.c Fri May 11 17:40:16 2018 +0200 +++ b/src/utils.c Fri May 11 18:13:54 2018 +0200 @@ -96,6 +96,12 @@ return strncmp((const char*)s1, (const char*)s2, *((size_t*) n)); } +int ucx_sstrcmp(const void *s1, const void *s2, void *data) { + sstr_t a = *(const sstr_t*) s1; + sstr_t b = *(const sstr_t*) s2; + return sstrcmp(a, b); +} + int ucx_intcmp(const void *i1, const void *i2, void *data) { int a = *((const int*) i1); int b = *((const int*) i2);