]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add "PREFIX-" when checking for isEmpty
authortcely <tcely@users.noreply.github.com>
Tue, 1 Aug 2017 00:58:05 +0000 (20:58 -0400)
committertcely <tcely@users.noreply.github.com>
Thu, 24 May 2018 15:29:28 +0000 (11:29 -0400)
This appears to have been a hack that got out-of-sync.
Adding a proper isEmpty() to the API is probably a better approach.

modules/luabackend/lua_functions.cc
modules/luabackend/luabackend.hh
modules/luabackend/minimal.cc
modules/luabackend/private.cc
modules/luabackend/reload.cc

index c33ba5c0314173095e0cad15383415be8b2637c6..2d48cfb3d0fc6a4ba1d27c45656787c1a56c8566 100644 (file)
@@ -91,7 +91,7 @@ int l_arg_get (lua_State *lua) {
 
     string a = lua_tostring(lua, 1);
 
-    if (::arg().isEmpty(a))
+    if (lb->my_isEmpty(a))
        lua_pushnil(lua);
     else
         lua_pushstring(lua, lb->my_getArg(a).c_str());
@@ -109,7 +109,7 @@ int l_arg_mustdo (lua_State *lua) {
 
     string a = lua_tostring(lua, 1);
 
-    if (::arg().isEmpty(a))
+    if (lb->my_isEmpty(a))
        lua_pushnil(lua);
     else
         lua_pushboolean(lua, lb->my_mustDo(a));
index 308c194eb76f021e5a9d3845fd091b31089336fc..9f335db5f0e1cc3217e8261b23f2a0efca360c12 100644 (file)
@@ -30,6 +30,7 @@
 #include <string>
 using std::string;
 
+#define LUABACKEND_PREFIX "lua"
 
 class LUAException {
 public:
@@ -107,6 +108,7 @@ public:
     //private.cc
     string my_getArg(string a);
     bool my_mustDo(string a);
+    bool my_isEmpty(string a);
 
 private:
 
index cf3545ee805ca2935bb2132ec8baacf767b6d725..29fab4d83e2d62c863ac0a8070db1c13f5c6845c 100644 (file)
@@ -32,7 +32,7 @@
 
 LUABackend::LUABackend(const string &suffix) {
 
-    setArgPrefix("lua"+suffix);
+    setArgPrefix(LUABACKEND_PREFIX+suffix);
 
     try {
 
index 78b2b5427a886a611bda324c0981bf49dc79ce9c..a23e5d20c61627fac8c2c76131df550fc5dea3ea 100644 (file)
@@ -36,6 +36,10 @@ bool LUABackend::my_mustDo(string a) {
     return mustDo(a);
 }
 
+bool LUABackend::my_isEmpty(string a) {
+    return ::arg().isEmpty(LUABACKEND_PREFIX+"-"+a);
+}
+
 bool LUABackend::domaininfo_from_table(DomainInfo *di) {
 
     di->backend = NULL;
index 2bc2696ac71e222aa10e7a4bcf21a0f31bbd87c0..18288f5f5cb895caef7ae6466509f813e541aff6 100644 (file)
@@ -41,7 +41,7 @@ void LUABackend::get_lua_function(lua_State *lua, const char *name, int *functio
     f.append(name);
     
     string arg = "";
-    if (!::arg().isEmpty(f))
+    if (!::arg().isEmpty(LUABACKEND_PREFIX+"-"+f))
         arg = getArg(f);
 
     lua_getglobal(lua, arg == "" ? name : arg.c_str());