aboutsummaryrefslogtreecommitdiff
path: root/src/compat
diff options
context:
space:
mode:
Diffstat (limited to 'src/compat')
-rw-r--r--src/compat/strnlen.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compat/strnlen.cpp b/src/compat/strnlen.cpp
index 7f3e159887..7dafd98c0b 100644
--- a/src/compat/strnlen.cpp
+++ b/src/compat/strnlen.cpp
@@ -7,12 +7,11 @@
#endif
#include <cstring>
-
-#if HAVE_DECL_STRNLEN == 0
-size_t strnlen( const char *start, size_t max_len)
+// OSX 10.6 is missing strnlen at runtime, but builds targetting it will still
+// succeed. Define our own version here to avoid a crash.
+size_t strnlen_int( const char *start, size_t max_len)
{
const char *end = (const char *)memchr(start, '\0', max_len);
return end ? (size_t)(end - start) : max_len;
}
-#endif // HAVE_DECL_STRNLEN