Wed, 27 Feb 2013 10:09:23 +0100
comparator module
1 #ifndef COMPARATOR_H
2 #define COMPARATOR_H
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 #include "ucx.h"
9 #include <string.h>
11 /**
12 * Wraps the strcmp function.
13 * @param s1 string one
14 * @param s2 string two
15 * @param data omitted
16 * @return the result of strcmp(s1, s2)
17 */
18 int ucx_strcmp(void *s1, void *s2, void *data);
20 /**
21 * Wraps the strncmp function.
22 * @param s1 string one
23 * @param s2 string two
24 * @param n a pointer to the size_t containing the third strncmp parameter
25 * @return the result of strncmp(s1, s2, *n)
26 */
27 int ucx_strncmp(void *s1, void *s2, void *n);
29 /**
30 * Compares two integers of type int.
31 * @param i1 pointer to integer one
32 * @param i2 pointer to integer two
33 * @param data omitted
34 * @return -1, if *i1 is less than *i2, 0 if both are equal,
35 * 1 if *i1 is greater than *i2
36 */
38 int ucx_intcmp(void *i1, void *i2, void *data);
40 /**
41 * Compares two pointers.
42 * @param ptr1 pointer one
43 * @param ptr2 pointer two
44 * @param data omitted
45 * @return -1 if ptr1 is less than ptr2, 0 if both are equal,
46 * 1 if ptr1 is greater than ptr2
47 */
48 int ucx_ptrcmp(void *ptr1, void *ptr2, void *data);
50 #ifdef __cplusplus
51 }
52 #endif
54 #endif /* COMPARATOR_H */