From 1bf018f5671ec26fea3c2a4bbe6ff23b4b1dc8e3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 29 Nov 2012 18:01:17 +0000 Subject: [PATCH] -make freebsd7 happy --- src/util/common_allocation.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 22dfb2509..89be027e7 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c @@ -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). * -- 2.25.1