-make freebsd7 happy
authorChristian Grothoff <christian@grothoff.org>
Thu, 29 Nov 2012 18:01:17 +0000 (18:01 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 29 Nov 2012 18:01:17 +0000 (18:01 +0000)
src/util/common_allocation.c

index 22dfb2509c3538fc459c9fac07538f4b15b930e0..89be027e706b5caa9ae22810d543a52666d8214b 100644 (file)
@@ -256,6 +256,21 @@ GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber)
 }
 
 
+#if ! HAVE_STRNLEN
+static size_t
+strnlen (const char *s, 
+        size_t n)
+{
+  const char *e;
+
+  e = memchr (s, '\0', n);
+  if (NULL == e)
+    return n;
+  return e - s;
+}
+#endif
+
+
 /**
  * Dup partially a string (same semantics as strndup).
  *