1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ucx/comparator.h Wed Feb 27 10:09:23 2013 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +#ifndef COMPARATOR_H 1.5 +#define COMPARATOR_H 1.6 + 1.7 +#ifdef __cplusplus 1.8 +extern "C" { 1.9 +#endif 1.10 + 1.11 +#include "ucx.h" 1.12 +#include <string.h> 1.13 + 1.14 +/** 1.15 + * Wraps the strcmp function. 1.16 + * @param s1 string one 1.17 + * @param s2 string two 1.18 + * @param data omitted 1.19 + * @return the result of strcmp(s1, s2) 1.20 + */ 1.21 +int ucx_strcmp(void *s1, void *s2, void *data); 1.22 + 1.23 +/** 1.24 + * Wraps the strncmp function. 1.25 + * @param s1 string one 1.26 + * @param s2 string two 1.27 + * @param n a pointer to the size_t containing the third strncmp parameter 1.28 + * @return the result of strncmp(s1, s2, *n) 1.29 + */ 1.30 +int ucx_strncmp(void *s1, void *s2, void *n); 1.31 + 1.32 +/** 1.33 + * Compares two integers of type int. 1.34 + * @param i1 pointer to integer one 1.35 + * @param i2 pointer to integer two 1.36 + * @param data omitted 1.37 + * @return -1, if *i1 is less than *i2, 0 if both are equal, 1.38 + * 1 if *i1 is greater than *i2 1.39 + */ 1.40 + 1.41 +int ucx_intcmp(void *i1, void *i2, void *data); 1.42 + 1.43 +/** 1.44 + * Compares two pointers. 1.45 + * @param ptr1 pointer one 1.46 + * @param ptr2 pointer two 1.47 + * @param data omitted 1.48 + * @return -1 if ptr1 is less than ptr2, 0 if both are equal, 1.49 + * 1 if ptr1 is greater than ptr2 1.50 + */ 1.51 +int ucx_ptrcmp(void *ptr1, void *ptr2, void *data); 1.52 + 1.53 +#ifdef __cplusplus 1.54 +} 1.55 +#endif 1.56 + 1.57 +#endif /* COMPARATOR_H */ 1.58 +