Added ndn_memcmp
diff --git a/ndn-cpp/c/util/ndn_memory.c b/ndn-cpp/c/util/ndn_memory.c
index d0e8bf4..12ee131 100644
--- a/ndn-cpp/c/util/ndn_memory.c
+++ b/ndn-cpp/c/util/ndn_memory.c
@@ -5,6 +5,24 @@
#include "ndn_memory.h"
+#if !HAVE_MEMCMP
+int ndn_memcmp(unsigned char *buf1, unsigned char *buf2, unsigned int len)
+{
+ unsigned int i;
+
+ for (i = 0; i < len; i++) {
+ if (buf1[i] > buf2[i])
+ return 1;
+ else if (buf1[i] < buf2[i])
+ return -1;
+ }
+
+ return 0;
+}
+#else
+int ndn_memcmp_stub_to_avoid_empty_file_warning = 0;
+#endif
+
#if !HAVE_MEMCPY
void ndn_memcpy(unsigned char *dest, unsigned char *src, unsigned int len)
{
@@ -27,4 +45,4 @@
}
#else
int ndn_memset_stub_to_avoid_empty_file_warning = 0;
-#endif
\ No newline at end of file
+#endif