diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-07-02 12:11:16 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-07-02 12:11:16 -0400 |
commit | d88ce331ef0d25a1db279d3ba7c952fbb63eabe7 (patch) | |
tree | 6cc5d2cbf3672b82db8e01029351a4ef9ddf9c34 | |
parent | cb1a3674ebb3826d9e1e56146210bd79cb4a42f0 (diff) | |
parent | c8ccd028a78d154c3b82138f7827aec0e2de13dd (diff) | |
download | tor-d88ce331ef0d25a1db279d3ba7c952fbb63eabe7.tar.gz tor-d88ce331ef0d25a1db279d3ba7c952fbb63eabe7.zip |
Merge branch 'bug26594'
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/lib/string/compat_string.h | 17 |
2 files changed, 16 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 97e8dadeba..98635bcbd8 100644 --- a/configure.ac +++ b/configure.ac @@ -610,6 +610,8 @@ AC_CHECK_FUNCS( sigaction \ socketpair \ statvfs \ + strncasecmp \ + strcasecmp \ strlcat \ strlcpy \ strnlen \ 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__ |