aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r--src/test/test_util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 8855cafc12..eb169f4dd5 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -2072,6 +2072,17 @@ test_util_sscanf(void *arg)
#define tt_char_op(a,op,b) tt_assert_op_type(a,op,b,char,"%c")
#define tt_ci_char_op(a,op,b) tt_char_op(tolower(a),op,tolower(b))
+#ifndef HAVE_STRNLEN
+static size_t
+strnlen(const char *s, size_t len)
+{
+ const char *p = memchr(s, 0, len);
+ if (!p)
+ return len;
+ return p - s;
+}
+#endif
+
static void
test_util_format_time_interval(void *arg)
{