]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Instruct LuaWrapper to stay away from our FFI pdns_ffi_param struct
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 12 Mar 2018 16:20:26 +0000 (17:20 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 26 Mar 2018 10:29:56 +0000 (12:29 +0200)
(cherry picked from commit 4a639c365df629466e4a2916360a41d8a4302144)

pdns/lua-recursor4.hh

index 324318971b2a92f4ad5d9445de04dbec776a432b..f19e620166a3de4bfce2499264672d14ed785777 100644 (file)
@@ -48,6 +48,18 @@ class LuaContext;
 #define L theL()
 #endif
 
+// pdns_ffi_param_t is a lightuserdata
+template<>
+struct LuaContext::Pusher<pdns_ffi_param*> {
+    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: