From acfbb13661f425631ee7e7f01daa1eb2f3169945 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 28 Nov 2018 12:27:14 -0800 Subject: macOS: replace local strnstr with strcasestr. bionic, glibc, macOS, and musl all have strcasestr (see http://man7.org/linux/man-pages/man3/strstr.3.html). macOS (via BSD) has a strnstr that does what strnstr sounds like it should do by analogy with strnlen and strncpy. So we at least need to rename strnstr, but it probably makes more sense just to switch to strcasestr instead. --- lib/portability.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/portability.h') diff --git a/lib/portability.h b/lib/portability.h index c76beef9..59430e1b 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -88,6 +88,9 @@ char *dirname(char *path); char *__xpg_basename(char *path); static inline char *basename(char *path) { return __xpg_basename(path); } +#include +char *strcasestr(const char *haystack, const char *needle); + // When building under obsolete glibc (Ubuntu 8.04-ish), hold its hand a bit. #if __GLIBC__ == 2 && __GLIBC_MINOR__ < 10 #define fstatat fstatat64 -- cgit v1.2.3