about summary refs log tree commit diff stats
path: root/src/luasec
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-22 19:25:05 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-22 19:25:05 -0800
commit1bf2504a8b4221da49b6c2aaf042d7ca8af43731 (patch)
tree11bdb1736ffb5654638a7828ea32abce418f644c /src/luasec
parent76329c0206ede0a986da423e6a813ef91334f6cd (diff)
downloadteliva-1bf2504a8b4221da49b6c2aaf042d7ca8af43731.tar.gz
clean up a warning and a bit of duplication
Now we have 2 probably-valid warnings caused by my edits, and 1
false-positive.
Diffstat (limited to 'src/luasec')
-rw-r--r--src/luasec/compat.h7
-rw-r--r--src/luasec/context.c21
-rw-r--r--src/luasec/context.h5
3 files changed, 2 insertions, 31 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