diff options
Diffstat (limited to 'src/lib/string')
-rw-r--r-- | src/lib/string/compat_string.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/lib/string/compat_string.h b/src/lib/string/compat_string.h index 24cd0f8b11..0a4ce01755 100644 --- a/src/lib/string/compat_string.h +++ b/src/lib/string/compat_string.h @@ -13,9 +13,20 @@ /* ===== String compatibility */ #ifdef _WIN32 -/* Windows names string functions differently from most other platforms. */ -#define strncasecmp _strnicmp -#define strcasecmp _stricmp +/* Windows doesn't have str(n)casecmp, but mingw defines it: only define it + * ourselves if it's missing. */ +#ifndef HAVE_STRNCASECMP +static inline int strncasecmp(const char *a, const char *b, size_t n); +static inline int strncasecmp(const char *a, const char *b, size_t n) { + return strncmpi(a,b); +} +#endif +#ifndef HAVE_STRCASECMP +static inline int strcasecmp(const char *a, const char *b, size_t n); +static inline int strcasecmp(const char *a, const char *b, size_t n) { + return strcmpi(a,b); +} +#endif #endif #if defined __APPLE__ |