aboutsummaryrefslogtreecommitdiff
path: root/src/string_util.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-27 20:26:07 +0100
committerMax Kellermann <max@duempel.org>2013-01-27 21:43:27 +0100
commit81557849909e4833a075f7be104031d751a31357 (patch)
tree1dc9f3924eea32e7edca2fa599b179274fa28a3d /src/string_util.h
parent44725e485db84c834782ade925dd31ae4341fecd (diff)
string_util: add fallback for strnlen()
Usually, when strndup() is not available, strndup() isn't either, because both are POSIX 2008.
Diffstat (limited to 'src/string_util.h')
-rw-r--r--src/string_util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/string_util.h b/src/string_util.h
index 374fd0f9..62de5387 100644
--- a/src/string_util.h
+++ b/src/string_util.h
@@ -83,6 +83,14 @@ strchug_fast(char *p)
bool
string_array_contains(const char *const* haystack, const char *needle);
+#ifndef HAVE_STRNLEN
+
+gcc_pure
+size_t
+strnlen(const char *s, size_t max);
+
+#endif
+
#if !defined(HAVE_STRNDUP)
/**