Don't set globals from C.

This commit is contained in:
Bruno Silvestre
2015-02-12 16:32:54 -02:00
parent 91d378a86e
commit 1ab6fac919
4 changed files with 8 additions and 76 deletions

View File

@ -816,7 +816,6 @@ static luaL_Reg funcs[] = {
/**
* Initialize modules.
*/
#if (LUA_VERSION_NUM == 501)
LSEC_API int luaopen_ssl_core(lua_State *L)
{
/* Initialize SSL */
@ -836,37 +835,7 @@ LSEC_API int luaopen_ssl_core(lua_State *L)
/* Register the functions and tables */
luaL_newmetatable(L, "SSL:Connection");
luaL_register(L, NULL, meta);
lua_newtable(L);
luaL_register(L, NULL, methods);
lua_setfield(L, -2, "__index");
luaL_register(L, "ssl.core", funcs);
return 1;
}
#else
LSEC_API int luaopen_ssl_core(lua_State *L)
{
/* Initialize SSL */
if (!SSL_library_init()) {
lua_pushstring(L, "unable to initialize SSL library");
lua_error(L);
}
OpenSSL_add_all_algorithms();
SSL_load_error_strings();
#if defined(WITH_LUASOCKET)
/* Initialize internal library */
socket_open();
#endif
luaL_newmetatable(L, "SSL:SNI:Registry");
/* Register the functions and tables */
luaL_newmetatable(L, "SSL:Connection");
luaL_setfuncs(L, meta, 0);
setfuncs(L, meta);
luaL_newlib(L, methods);
lua_setfield(L, -2, "__index");
@ -875,4 +844,3 @@ LSEC_API int luaopen_ssl_core(lua_State *L)
return 1;
}
#endif