From: Remi Gacogne Date: Mon, 20 Nov 2023 15:49:24 +0000 (+0100) Subject: dnsdist: Fix a few warnings from clang-tidy X-Git-Tag: rec-5.0.0-rc1~27^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bf9461f901f244a59de1e4aedf456600816ef9b3;p=thirdparty%2Fpdns.git dnsdist: Fix a few warnings from clang-tidy --- diff --git a/pdns/dnsdist-lua-bindings.cc b/pdns/dnsdist-lua-bindings.cc index 9f393f1691..ff08875dcc 100644 --- a/pdns/dnsdist-lua-bindings.cc +++ b/pdns/dnsdist-lua-bindings.cc @@ -283,54 +283,54 @@ void setupLuaBindings(LuaContext& luaCtx, bool client) /* SuffixMatchNode */ luaCtx.registerFunction, LuaArray> &name)>("add", [](SuffixMatchNode &smn, const boost::variant, LuaArray> &name) { if (name.type() == typeid(DNSName)) { - const auto& n = boost::get(name); - smn.add(n); + const auto& actualName = boost::get(name); + smn.add(actualName); return; } if (name.type() == typeid(std::string)) { - const auto& n = boost::get(name); - smn.add(n); + const auto& actualName = boost::get(name); + smn.add(actualName); return; } if (name.type() == typeid(LuaArray)) { const auto& names = boost::get>(name); - for (const auto& n : names) { - smn.add(n.second); + for (const auto& actualName : names) { + smn.add(actualName.second); } return; } if (name.type() == typeid(LuaArray)) { const auto& names = boost::get>(name); - for (const auto& n : names) { - smn.add(n.second); + for (const auto& actualName : names) { + smn.add(actualName.second); } return; } }); luaCtx.registerFunction, LuaArray> &name)>("remove", [](SuffixMatchNode &smn, const boost::variant, LuaArray> &name) { if (name.type() == typeid(DNSName)) { - auto n = boost::get(name); - smn.remove(n); + auto actualName = boost::get(name); + smn.remove(actualName); return; } if (name.type() == typeid(string)) { - const auto& n = boost::get(name); - DNSName d(n); - smn.remove(d); + const auto& actualName = boost::get(name); + DNSName dnsName(actualName); + smn.remove(dnsName); return; } if (name.type() == typeid(LuaArray)) { auto names = boost::get>(name); - for (const auto& n : names) { - smn.remove(n.second); + for (const auto& actualName : names) { + smn.remove(actualName.second); } return; } if (name.type() == typeid(LuaArray)) { auto names = boost::get>(name); - for (const auto& n : names) { - DNSName d(n.second); - smn.remove(d); + for (const auto& actualName : names) { + DNSName dnsName(actualName.second); + smn.remove(dnsName); } return; } @@ -349,16 +349,16 @@ void setupLuaBindings(LuaContext& luaCtx, bool client) #ifndef DISABLE_NETMASK_BINDINGS /* Netmask */ - luaCtx.writeFunction("newNetmask", [](boost::variant s, boost::optional bits) { - if (s.type() == typeid(ComboAddress)) { - const auto& ca = boost::get(s); + luaCtx.writeFunction("newNetmask", [](boost::variant addrOrStr, boost::optional bits) { + if (addrOrStr.type() == typeid(ComboAddress)) { + const auto& comboAddr = boost::get(addrOrStr); if (bits) { - return Netmask(ca, *bits); + return Netmask(comboAddr, *bits); } - return Netmask(ca); + return Netmask(comboAddr); } - else if (s.type() == typeid(std::string)) { - const auto& str = boost::get(s); + else if (addrOrStr.type() == typeid(std::string)) { + const auto& str = boost::get(addrOrStr); return Netmask(str); } throw std::runtime_error("Invalid parameter passed to 'newNetmask()'");