]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: hlua_fcn: register queue class using hlua_register_metatable()
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 21 Mar 2025 22:00:59 +0000 (23:00 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 3 Apr 2025 15:52:17 +0000 (17:52 +0200)
Most lua classes are registered by leveraging the
hlua_register_metatable() helper. Let's use that for the Queue class as
well for consitency.

include/haproxy/hlua-t.h
src/hlua_fcn.c

index 277586304d2015b2bad4a20ec77e65f7420ad5b0..ed2cfad750d378a49155c6ad4a124605ee4caeb7 100644 (file)
@@ -60,6 +60,7 @@
 #define CLASS_CERTCACHE    "CertCache"
 #define CLASS_PROXY_LIST   "ProxyList"
 #define CLASS_SERVER_LIST  "ServerList"
+#define CLASS_QUEUE        "Queue"
 
 struct stream;
 
index dee1d4216823a6e6f83d65a8f443fa14bf6e21fb..6d3d6696d197f4d92703b2aa012cf20707d6133c 100644 (file)
@@ -728,7 +728,7 @@ static void hlua_queue_init(lua_State *L)
 
        hlua_class_function(L, "__gc", hlua_queue_gc);
 
-       class_queue_ref = luaL_ref(L, LUA_REGISTRYINDEX);
+       class_queue_ref = hlua_register_metatable(L, CLASS_QUEUE);
 }
 
 int hlua_fcn_new_stktable(lua_State *L, struct stktable *tbl)