diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luasec/compat.h | 7 | ||||
-rw-r--r-- | src/luasec/context.c | 21 | ||||
-rw-r--r-- | src/luasec/context.h | 5 | ||||
-rw-r--r-- | src/luasocket/compat.h | 4 |
4 files changed, 2 insertions, 35 deletions
diff --git a/src/luasec/compat.h b/src/luasec/compat.h index 1c88de9..37eff81 100644 --- a/src/luasec/compat.h +++ b/src/luasec/compat.h @@ -20,9 +20,6 @@ //------------------------------------------------------------------------------ -#if (LUA_VERSION_NUM == 501) - -#define luaL_testudata(L, ud, tname) lsec_testudata(L, ud, tname) #define setfuncs(L, R) luaL_register(L, NULL, R) #define lua_rawlen(L, i) lua_objlen(L, i) @@ -30,10 +27,6 @@ #define luaL_newlib(L, R) do { lua_newtable(L); luaL_register(L, NULL, R); } while(0) #endif -#else -#define setfuncs(L, R) luaL_setfuncs(L, R, 0) -#endif - //------------------------------------------------------------------------------ #if (!defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x1010000fL)) diff --git a/src/luasec/context.c b/src/luasec/context.c index b67f36f..0cbfb76 100644 --- a/src/luasec/context.c +++ b/src/luasec/context.c @@ -43,7 +43,7 @@ static p_context checkctx(lua_State *L, int idx) static p_context testctx(lua_State *L, int idx) { - return (p_context)luaL_testudata(L, idx, "SSL:Context"); + return (p_context)luasocket_testudata(L, idx, "SSL:Context"); } /** @@ -887,25 +887,6 @@ int lsec_getmode(lua_State *L, int idx) return ctx->mode; } -/*-- Compat - Lua 5.1 --*/ -#if (LUA_VERSION_NUM == 501) - -void *lsec_testudata (lua_State *L, int ud, const char *tname) { - void *p = lua_touserdata(L, ud); - if (p != NULL) { /* value is a userdata? */ - if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ - luaL_getmetatable(L, tname); /* get correct metatable */ - if (!lua_rawequal(L, -1, -2)) /* not the same? */ - p = NULL; /* value is a userdata with wrong metatable */ - lua_pop(L, 2); /* remove both metatables */ - return p; - } - } - return NULL; /* value is not a userdata with a metatable */ -} - -#endif - /*------------------------------ Initialization ------------------------------*/ /** diff --git a/src/luasec/context.h b/src/luasec/context.h index 21202cb..b51cd44 100644 --- a/src/luasec/context.h +++ b/src/luasec/context.h @@ -39,9 +39,6 @@ int lsec_getmode(lua_State *L, int idx); /* Registre the module. */ LSEC_API int luaopen_ssl_context(lua_State *L); -/* Compat - Lua 5.1 */ -#if (LUA_VERSION_NUM == 501) -void *lsec_testudata (lua_State *L, int ud, const char *tname); -#endif +void *luasocket_testudata ( lua_State *L, int arg, const char *tname); #endif diff --git a/src/luasocket/compat.h b/src/luasocket/compat.h index fa2d7d7..1422728 100644 --- a/src/luasocket/compat.h +++ b/src/luasocket/compat.h @@ -1,8 +1,6 @@ #ifndef COMPAT_H #define COMPAT_H -#if LUA_VERSION_NUM==501 - #ifndef _WIN32 #pragma GCC visibility push(hidden) #endif @@ -18,5 +16,3 @@ void *luasocket_testudata ( lua_State *L, int arg, const char *tname); #define luaL_testudata luasocket_testudata #endif - -#endif |