]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: lua-thread: Stop usage of struct hlua for the global lua state
authorThierry Fournier <thierry.fournier@ozon.io>
Sat, 28 Nov 2020 10:21:25 +0000 (11:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 2 Dec 2020 20:53:16 +0000 (21:53 +0100)
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.

src/hlua.c

index 3d92c7d08b09174e3034ce89fface445098aafb7..f6db9fec1abb957ce12d5ad385f8a89105374d07 100644 (file)
@@ -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);