about summary refs log tree commit diff stats
path: root/src/luasec/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/luasec/context.c')
-rw-r--r--src/luasec/context.c21
1 files changed, 1 insertions, 20 deletions
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 ------------------------------*/
 
 /**