From: Thierry Fournier Date: Sat, 28 Nov 2020 10:21:25 +0000 (+0100) Subject: MINOR: lua-thread: Stop usage of struct hlua for the global lua state X-Git-Tag: v2.4-dev3~119 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92689e651e59decfc567893c148a3beb546e3d7c;p=thirdparty%2Fhaproxy.git MINOR: lua-thread: Stop usage of struct hlua for the global lua state The goal is to no longer use "struct hlua" with global main lua_state. The usage of the "struct hlua" is no longer required. This patch replaces this struct by another one. Now, the usage of runtime Lua phase is separated from the start lua phase. --- diff --git a/src/hlua.c b/src/hlua.c index 3d92c7d08b..f6db9fec1a 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -157,7 +157,9 @@ static int hlua_panic_ljmp(lua_State *L) { WILL_LJMP(longjmp(safe_ljmp_env, 1)); #define APPLET_RSP_SENT 0x40 /* The response was fully sent */ /* The main Lua execution context. */ -struct hlua gL; +struct { + lua_State *T; +} gL; /* This is the memory pool containing struct lua for applets * (including cli). @@ -8400,12 +8402,7 @@ void hlua_init(void) #endif /* Init main lua stack. */ - gL.Mref = LUA_REFNIL; - gL.flags = 0; - LIST_INIT(&gL.com); gL.T = lua_newstate(hlua_alloc, &hlua_global_allocator); - gL.Tref = LUA_REFNIL; - gL.task = NULL; /* Initialise Lua context to NULL */ context = lua_getextraspace(gL.T);