From: Remi Gacogne Date: Mon, 12 Mar 2018 16:20:26 +0000 (+0100) Subject: rec: Instruct LuaWrapper to stay away from our FFI pdns_ffi_param struct X-Git-Tag: rec-4.1.2~2^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f22e21d542a66e824b5ebca963a5e2c36c3208c7;p=thirdparty%2Fpdns.git rec: Instruct LuaWrapper to stay away from our FFI pdns_ffi_param struct (cherry picked from commit 4a639c365df629466e4a2916360a41d8a4302144) --- diff --git a/pdns/lua-recursor4.hh b/pdns/lua-recursor4.hh index 324318971b..f19e620166 100644 --- a/pdns/lua-recursor4.hh +++ b/pdns/lua-recursor4.hh @@ -48,6 +48,18 @@ class LuaContext; #define L theL() #endif +// pdns_ffi_param_t is a lightuserdata +template<> +struct LuaContext::Pusher { + static const int minSize = 1; + static const int maxSize = 1; + + static PushedObject push(lua_State* state, pdns_ffi_param* ptr) noexcept { + lua_pushlightuserdata(state, ptr); + return PushedObject{state, 1}; + } +}; + class RecursorLua4 : public boost::noncopyable { private: