]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: hlua: add simple hlua reference handling API
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 2 Mar 2023 16:50:49 +0000 (17:50 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:58:17 +0000 (08:58 +0200)
commitf8f8a2b872d10bb5fdedf2c92aed3013649e0e19
treec2f461dbfe7a48a80f8d92e0defc7b59bd7c2314
parent60ab0f7d207addd0ff2d2b767d1e25fd62d56eda
MINOR: hlua: add simple hlua reference handling API

We're doing this in an attempt to simplify temporary lua objects
references handling.

Adding the new hlua_unref() function to release lua object references
created using luaL_ref(, LUA_REGISTRYINDEX)
(ie: hlua_checkfunction() and hlua_checktable())

Failure to release unused object reference prevents the reference index
from being re-used and prevents the referred ressource from being garbage
collected.

Adding hlua_pushref(L, ref) to replace
lua_rawgeti(L, LUA_REGISTRYINDEX, ref)

Adding hlua_ref(L) to replace luaL_ref(L, LUA_REGISTRYINDEX)
src/hlua.c