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