From: Ensar Sarajčić Date: Wed, 5 Feb 2025 17:10:52 +0000 (+0100) Subject: Fix clang-tidy warnings X-Git-Tag: dnsdist-2.0.0-alpha1~111^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd65e609683f2f7452f85851d5a387587c66066d;p=thirdparty%2Fpdns.git Fix clang-tidy warnings --- diff --git a/pdns/dnsdistdist/dnsdist-lua-bindings-protobuf.cc b/pdns/dnsdistdist/dnsdist-lua-bindings-protobuf.cc index 59ec33c33d..b5365a42e5 100644 --- a/pdns/dnsdistdist/dnsdist-lua-bindings-protobuf.cc +++ b/pdns/dnsdistdist/dnsdist-lua-bindings-protobuf.cc @@ -50,11 +50,11 @@ static void parseFSTRMOptions(boost::optional> void setupLuaBindingsProtoBuf(LuaContext& luaCtx, bool client, bool configCheck) { #ifdef HAVE_IPCIPHER - luaCtx.registerFunction("ipencrypt", [](const ComboAddress& ca, const std::string& key) { - return encryptCA(ca, key); + luaCtx.registerFunction("ipencrypt", [](const ComboAddress& comboAddress, const std::string& key) { + return encryptCA(comboAddress, key); }); - luaCtx.registerFunction("ipdecrypt", [](const ComboAddress& ca, const std::string& key) { - return decryptCA(ca, key); + luaCtx.registerFunction("ipdecrypt", [](const ComboAddress& comboAddress, const std::string& key) { + return decryptCA(comboAddress, key); }); luaCtx.writeFunction("makeIPCipherKey", [](const std::string& password) { @@ -129,13 +129,12 @@ void setupLuaBindingsProtoBuf(LuaContext& luaCtx, bool client, bool configCheck) if (count > 1) { std::vector> loggers; for (uint64_t i = 0; i < count; i++) { - loggers.emplace_back(new RemoteLogger(ComboAddress(remote), timeout ? *timeout : 2, maxQueuedEntries ? (*maxQueuedEntries * 100) : 10000, reconnectWaitTime ? *reconnectWaitTime : 1, client)); + loggers.push_back(std::make_shared(ComboAddress(remote), timeout ? *timeout : 2, maxQueuedEntries ? (*maxQueuedEntries * 100) : 10000, reconnectWaitTime ? *reconnectWaitTime : 1, client)); } return std::shared_ptr(new RemoteLoggerPool(std::move(loggers))); } - else { - return std::shared_ptr(new RemoteLogger(ComboAddress(remote), timeout ? *timeout : 2, maxQueuedEntries ? (*maxQueuedEntries * 100) : 10000, reconnectWaitTime ? *reconnectWaitTime : 1, client)); - } + + return std::shared_ptr(new RemoteLogger(ComboAddress(remote), timeout ? *timeout : 2, maxQueuedEntries ? (*maxQueuedEntries * 100) : 10000, reconnectWaitTime ? *reconnectWaitTime : 1, client)); }); luaCtx.writeFunction("newFrameStreamUnixLogger", [client, configCheck]([[maybe_unused]] const std::string& address, [[maybe_unused]] boost::optional> params) { @@ -153,15 +152,14 @@ void setupLuaBindingsProtoBuf(LuaContext& luaCtx, bool client, bool configCheck) if (count > 1) { std::vector> loggers; for (uint64_t i = 0; i < count; i++) { - loggers.emplace_back(new FrameStreamLogger(AF_UNIX, address, !client, options)); + loggers.push_back(std::make_shared(AF_UNIX, address, !client, options)); } return std::shared_ptr(new RemoteLoggerPool(std::move(loggers))); } - else { - return std::shared_ptr(new FrameStreamLogger(AF_UNIX, address, !client, options)); - } + + return std::shared_ptr(new FrameStreamLogger(AF_UNIX, address, !client, options)); #else - throw std::runtime_error("fstrm support is required to build an AF_UNIX FrameStreamLogger"); + throw std::runtime_error("fstrm support is required to build an AF_UNIX FrameStreamLogger"); #endif /* HAVE_FSTRM */ }); @@ -180,15 +178,14 @@ void setupLuaBindingsProtoBuf(LuaContext& luaCtx, bool client, bool configCheck) if (count > 1) { std::vector> loggers; for (uint64_t i = 0; i < count; i++) { - loggers.emplace_back(new FrameStreamLogger(AF_INET, address, !client, options)); + loggers.push_back(std::make_shared(AF_INET, address, !client, options)); } return std::shared_ptr(new RemoteLoggerPool(std::move(loggers))); } - else { - return std::shared_ptr(new FrameStreamLogger(AF_INET, address, !client, options)); - } + + return std::shared_ptr(new FrameStreamLogger(AF_INET, address, !client, options)); #else - throw std::runtime_error("fstrm with TCP support is required to build an AF_INET FrameStreamLogger"); + throw std::runtime_error("fstrm with TCP support is required to build an AF_INET FrameStreamLogger"); #endif /* HAVE_FSTRM */ });