summaryrefslogtreecommitdiff
path: root/src/string_func.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-05-18 21:17:25 +0000
committerrubidium <rubidium@openttd.org>2010-05-18 21:17:25 +0000
commit2de9e2d16b058971bf22e18062fc26278098dfb0 (patch)
tree8640104e4d0da4f42730c487eb227688807ca1e3 /src/string_func.h
parent354645cd0af62605030514c66bfa59795fe999b9 (diff)
downloadopenttd-2de9e2d16b058971bf22e18062fc26278098dfb0.tar.xz
(svn r19853) -Fix [FS#3840]: revert r19781 and apply a more sensible version with the same effect
Diffstat (limited to 'src/string_func.h')
-rw-r--r--src/string_func.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/string_func.h b/src/string_func.h
index 2ff5f0439..942873593 100644
--- a/src/string_func.h
+++ b/src/string_func.h
@@ -246,13 +246,18 @@ static inline bool IsWhitespace(WChar c)
;
}
-#ifndef _GNU_SOURCE
+/* Needed for NetBSD version (so feature) testing */
+#ifdef __NetBSD__
+#include <sys/param.h>
+#endif
+
+#if !defined(_GNU_SOURCE) && !(defined(__NetBSD_Version__) && 400000000 < __NetBSD_Version__ )
/* strndup is a GNU extension */
char *strndup(const char *s, size_t len);
#endif /* !_GNU_SOURCE */
/* strcasestr is available for _GNU_SOURCE, BSD and some Apple */
-#if defined(_GNU_SOURCE) || (defined(__BSD_VISIBLE) && __BSD_VISIBLE) || (defined(__APPLE__) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)))
+#if defined(_GNU_SOURCE) || (defined(__BSD_VISIBLE) && __BSD_VISIBLE) || (defined(__APPLE__) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))) || _NETBSD_SOURCE
# undef DEFINE_STRCASESTR
#else
# define DEFINE_STRCASESTR