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
--- a/ucx/comparator.c	Wed Feb 27 10:28:02 2013 +0100
+++ b/ucx/comparator.c	Wed Feb 27 10:35:42 2013 +0100
@@ -25,3 +25,7 @@
         return ptr1 < ptr2 ? -1 : 1;
     }
 }
+
+int ucx_memcmp(void *ptr1, void *ptr2, void *n) {
+    return memcmp(ptr1, ptr2, *((size_t*)n));
+}
--- a/ucx/comparator.h	Wed Feb 27 10:28:02 2013 +0100
+++ b/ucx/comparator.h	Wed Feb 27 10:35:42 2013 +0100
@@ -47,6 +47,15 @@
  */
 int ucx_ptrcmp(void *ptr1, void *ptr2, void *data);
 
+/**
+ * Compares two memory areas.
+ * @param ptr1 pointer one
+ * @param ptr2 pointer two
+ * @param n a pointer to the size_t containing the third parameter for memcmp
+ * @return the result of memcmp(ptr1, ptr2, *n)
+ */
+int ucx_memcmp(void *ptr1, void *ptr2, void *n);
+
 #ifdef	__cplusplus
 }
 #endif

mercurial