]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Work around a compiler bug seen on OpenBSD/amd64 using clang-13 and make the code... 11176/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 12 Jan 2022 12:49:53 +0000 (13:49 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 12 Jan 2022 12:52:27 +0000 (13:52 +0100)
Fixes #11113.

pdns/dnsdist-lua-bindings.cc

index bc264ab67ea09e7d7bf5b66c68f9c456058579bb..c5b66c6d18938e9da5f96346a36039acbf1bbd06 100644 (file)
@@ -69,12 +69,18 @@ void setupLuaBindings(LuaContext& luaCtx, bool client)
   luaCtx.registerFunction("toString", &ServerPolicy::toString);
   luaCtx.registerFunction("__tostring", &ServerPolicy::toString);
 
-  luaCtx.writeVariable("firstAvailable", ServerPolicy{"firstAvailable", firstAvailable, false});
-  luaCtx.writeVariable("roundrobin", ServerPolicy{"roundrobin", roundrobin, false});
-  luaCtx.writeVariable("wrandom", ServerPolicy{"wrandom", wrandom, false});
-  luaCtx.writeVariable("whashed", ServerPolicy{"whashed", whashed, false});
-  luaCtx.writeVariable("chashed", ServerPolicy{"chashed", chashed, false});
-  luaCtx.writeVariable("leastOutstanding", ServerPolicy{"leastOutstanding", leastOutstanding, false});
+  ServerPolicy policies[] = {
+    ServerPolicy{"firstAvailable", firstAvailable, false},
+    ServerPolicy{"roundrobin", roundrobin, false},
+    ServerPolicy{"wrandom", wrandom, false},
+    ServerPolicy{"whashed", whashed, false},
+    ServerPolicy{"chashed", chashed, false},
+    ServerPolicy{"leastOutstanding", leastOutstanding, false}
+  };
+  for (auto& policy : policies) {
+    luaCtx.writeVariable(policy.d_name, policy);
+  }
+
 #endif /* DISABLE_POLICIES_BINDINGS */
 
   /* ServerPool */