diff options
author | William Ahern <william+ubuntu@25thandClement.com> | 2016-11-01 17:04:24 -0700 |
---|---|---|
committer | William Ahern <william+ubuntu@25thandClement.com> | 2016-11-01 17:04:24 -0700 |
commit | cb727f97f2e00512c70631210de2d8b951e81587 (patch) | |
tree | 48f80ac0065f3b9224adaee4beee8edfc41861ae /src | |
parent | f7e633337555bb70996347abe90efdae7ed7b632 (diff) | |
download | luaossl-cb727f97f2e00512c70631210de2d8b951e81587.tar.gz luaossl-cb727f97f2e00512c70631210de2d8b951e81587.tar.bz2 luaossl-cb727f97f2e00512c70631210de2d8b951e81587.zip |
workaround for broken GCC on some newer debian/ubuntu installations with weird GCC default flags that fail compilation on C99-style for loops without any other warning flags specified
Diffstat (limited to 'src')
-rw-r--r-- | src/openssl.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/openssl.c b/src/openssl.c index ed7222e..4564061 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -772,8 +772,9 @@ 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 i; - for (int i = 0; optlist[i]; i++) { + for (i = 0; optlist[i]; i++) { if (0 == optcmp(optlist[i], optname)) return i; } @@ -929,9 +930,11 @@ static inline size_t auxL_liblen(const auxL_Reg *l) { static void auxL_setfuncs(lua_State *L, const auxL_Reg *l, int nups) { for (; l->name; l++) { + int i; + /* copy shared upvalues */ luaL_checkstack(L, nups, "too many upvalues"); - for (int i = 0; i < nups; i++) + for (i = 0; i < nups; i++) lua_pushvalue(L, -nups); /* nil-fill local upvalues */ @@ -3741,13 +3744,15 @@ static int pk_getParameters(lua_State *L) { return luaL_error(L, "%d: unsupported EVP_PKEY base type", base_type); if (lua_isnoneornil(L, 2)) { + const char *const *optname; + /* * Use special "{" parameter to tell loop to push table. * Subsequent parameters will be assigned as fields. */ lua_pushstring(L, "{"); luaL_checkstack(L, nopts, "too many arguments"); - for (const char *const *optname = optlist; *optname; optname++) { + for (optname = optlist; *optname; optname++) { lua_pushstring(L, *optname); } } @@ -3927,11 +3932,12 @@ static const auxL_Reg pk_globals[] = { }; static void pk_luainit(lua_State *L, _Bool reset) { + char **k; if (!auxL_newmetatable(L, PKEY_CLASS, reset)) return; auxL_setfuncs(L, pk_metatable, 0); auxL_newlib(L, pk_methods, 0); - for (char **k = (char *[]){ "__index", "__newindex", 0 }; *k; k++) { + for (k = (char *[]){ "__index", "__newindex", 0 }; *k; k++) { lua_getfield(L, -2, *k); /* closure */ lua_pushvalue(L, -2); /* method table */ lua_setupvalue(L, -2, 1); |