Fri, 11 May 2018 18:13:54 +0200
adds ucx_sstrcmp() compare function to utils.h
src/ucx/utils.h | file | annotate | diff | comparison | revisions | |
src/utils.c | file | annotate | diff | comparison | revisions |
1.1 --- a/src/ucx/utils.h Fri May 11 17:40:16 2018 +0200 1.2 +++ b/src/ucx/utils.h Fri May 11 18:13:54 2018 +0200 1.3 @@ -156,6 +156,15 @@ 1.4 int ucx_strncmp(const void *s1, const void *s2, void *n); 1.5 1.6 /** 1.7 + * Wraps the sstrcmp function. 1.8 + * @param s1 sstr one 1.9 + * @param s2 sstr two 1.10 + * @param data ignored 1.11 + * @return the result of sstrcmp(s1, s2) 1.12 + */ 1.13 +int ucx_sstrcmp(const void *s1, const void *s2, void *data); 1.14 + 1.15 +/** 1.16 * Compares two integers of type int. 1.17 * @param i1 pointer to integer one 1.18 * @param i2 pointer to integer two
2.1 --- a/src/utils.c Fri May 11 17:40:16 2018 +0200 2.2 +++ b/src/utils.c Fri May 11 18:13:54 2018 +0200 2.3 @@ -96,6 +96,12 @@ 2.4 return strncmp((const char*)s1, (const char*)s2, *((size_t*) n)); 2.5 } 2.6 2.7 +int ucx_sstrcmp(const void *s1, const void *s2, void *data) { 2.8 + sstr_t a = *(const sstr_t*) s1; 2.9 + sstr_t b = *(const sstr_t*) s2; 2.10 + return sstrcmp(a, b); 2.11 +} 2.12 + 2.13 int ucx_intcmp(const void *i1, const void *i2, void *data) { 2.14 int a = *((const int*) i1); 2.15 int b = *((const int*) i2);