aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-04-04 02:13:10 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-09-02 04:09:51 +1000
commit8949ef3cf68bb5038cfffefcb2fed0c2c30180d8 (patch)
tree4cc10c956cdab11cd5723ec988563f223b028559
parent912438dde5babdd04acf062d9aef45fa0ac1c1c2 (diff)
downloadluaossl-8949ef3cf68bb5038cfffefcb2fed0c2c30180d8.tar.gz
luaossl-8949ef3cf68bb5038cfffefcb2fed0c2c30180d8.tar.bz2
luaossl-8949ef3cf68bb5038cfffefcb2fed0c2c30180d8.zip
windows doesn't have strings.h for strcasecmp, however it does have _stricmp
-rw-r--r--src/openssl.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 5c47635..b9aaeb2 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -30,7 +30,6 @@
#include <limits.h> /* INT_MAX INT_MIN LLONG_MAX LLONG_MIN UCHAR_MAX ULLONG_MAX */
#include <stdint.h> /* uintptr_t */
#include <string.h> /* memset(3) strerror_r(3) */
-#include <strings.h> /* strcasecmp(3) */
#include <math.h> /* INFINITY fabs(3) floor(3) frexp(3) fmod(3) round(3) isfinite(3) */
#include <time.h> /* struct tm time_t strptime(3) time(2) */
#include <ctype.h> /* isdigit(3), isxdigit(3), tolower(3) */
@@ -493,7 +492,12 @@
#undef MIN
#define MIN(a, b) (((a) < (b))? (a) : (b))
+#ifdef _WIN32
+#define stricmp(a, b) _stricmp((a), (b))
+#else
+#include <strings.h> /* strcasecmp(3) */
#define stricmp(a, b) strcasecmp((a), (b))
+#endif
#define strieq(a, b) (!stricmp((a), (b)))
#define xtolower(c) tolower((unsigned char)(c))
@@ -988,7 +992,13 @@ NOTUSED static auxtype_t auxL_getref(lua_State *L, auxref_t ref) {
static int auxL_testoption(lua_State *L, int index, const char *def, const char *const *optlist, _Bool nocase) {
const char *optname = (def)? luaL_optstring(L, index, def) : luaL_checkstring(L, index);
- int (*optcmp)() = (nocase)? &strcasecmp : &strcmp;
+ int (*optcmp)() = (nocase)?
+#ifdef _WIN32
+ &_stricmp
+#else
+ &strcasecmp
+#endif
+ : &strcmp;
int i;
for (i = 0; optlist[i]; i++) {