added memcmp to the comparator module

Wed, 27 Feb 2013 10:35:42 +0100

author
Mike Becker <universe@uap-core.de>
date
Wed, 27 Feb 2013 10:35:42 +0100
changeset 91
91595a45fad6
parent 90
ef3163857e88
child 92
7625a8efcc97

added memcmp to the comparator module

ucx/comparator.c file | annotate | diff | comparison | revisions
ucx/comparator.h file | annotate | diff | comparison | revisions
     1.1 --- a/ucx/comparator.c	Wed Feb 27 10:28:02 2013 +0100
     1.2 +++ b/ucx/comparator.c	Wed Feb 27 10:35:42 2013 +0100
     1.3 @@ -25,3 +25,7 @@
     1.4          return ptr1 < ptr2 ? -1 : 1;
     1.5      }
     1.6  }
     1.7 +
     1.8 +int ucx_memcmp(void *ptr1, void *ptr2, void *n) {
     1.9 +    return memcmp(ptr1, ptr2, *((size_t*)n));
    1.10 +}
     2.1 --- a/ucx/comparator.h	Wed Feb 27 10:28:02 2013 +0100
     2.2 +++ b/ucx/comparator.h	Wed Feb 27 10:35:42 2013 +0100
     2.3 @@ -47,6 +47,15 @@
     2.4   */
     2.5  int ucx_ptrcmp(void *ptr1, void *ptr2, void *data);
     2.6  
     2.7 +/**
     2.8 + * Compares two memory areas.
     2.9 + * @param ptr1 pointer one
    2.10 + * @param ptr2 pointer two
    2.11 + * @param n a pointer to the size_t containing the third parameter for memcmp
    2.12 + * @return the result of memcmp(ptr1, ptr2, *n)
    2.13 + */
    2.14 +int ucx_memcmp(void *ptr1, void *ptr2, void *n);
    2.15 +
    2.16  #ifdef	__cplusplus
    2.17  }
    2.18  #endif

mercurial