From 4f6f54c058b16d1e04a73ab3c0e46e4c0a495530 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 8 Dec 2024 17:34:39 -0800 Subject: [PATCH 1/2] remove lexical_cast headers These are unused Signed-off-by: Rosen Penev --- m4/boost.m4 | 16 ---------------- modules/lua2backend/lua2api2.hh | 1 - .../dnsdist-lua-bindings-packetcache.cc | 2 -- 3 files changed, 19 deletions(-) diff --git a/m4/boost.m4 b/m4/boost.m4 index 973c447b0fa5..c5de2b63a676 100644 --- a/m4/boost.m4 +++ b/m4/boost.m4 @@ -622,13 +622,6 @@ BOOST_DEFUN([Bind], [BOOST_FIND_HEADER([boost/bind.hpp])]) -# BOOST_CAST() -# ------------ -# Look for Boost.Cast -BOOST_DEFUN([Cast], -[BOOST_FIND_HEADER([boost/cast.hpp])]) - - # BOOST_CHRONO([PREFERRED-RT-OPT], [ERROR_ON_UNUSABLE]) # -------------- # Look for Boost.Chrono. @@ -796,15 +789,6 @@ LDFLAGS=$boost_context_save_LDFLAGS ])# BOOST_CONTEXT -# BOOST_CONVERSION() -# ------------------ -# Look for Boost.Conversion (cast / lexical_cast) -BOOST_DEFUN([Conversion], -[BOOST_FIND_HEADER([boost/cast.hpp]) -BOOST_FIND_HEADER([boost/lexical_cast.hpp]) -])# BOOST_CONVERSION - - # BOOST_COROUTINE([PREFERRED-RT-OPT], [ERROR_ON_UNUSABLE]) # ----------------------------------- # Look for Boost.Coroutine. For the documentation of PREFERRED-RT-OPT, see the diff --git a/modules/lua2backend/lua2api2.hh b/modules/lua2backend/lua2api2.hh index 857fb1782c4a..ba744da99a20 100644 --- a/modules/lua2backend/lua2api2.hh +++ b/modules/lua2backend/lua2api2.hh @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once -#include "boost/lexical_cast.hpp" #include "boost/algorithm/string/join.hpp" #include "pdns/arguments.hh" diff --git a/pdns/dnsdistdist/dnsdist-lua-bindings-packetcache.cc b/pdns/dnsdistdist/dnsdist-lua-bindings-packetcache.cc index 30a09d6c4c24..6ca827af2ad0 100644 --- a/pdns/dnsdistdist/dnsdist-lua-bindings-packetcache.cc +++ b/pdns/dnsdistdist/dnsdist-lua-bindings-packetcache.cc @@ -28,8 +28,6 @@ #include "dnsdist-cache.hh" #include "dnsdist-lua.hh" -#include - void setupLuaBindingsPacketCache(LuaContext& luaCtx, bool client) { /* PacketCache */ From 34f7f05eebdc4eed7c907ffa0bd048cddc2b6286 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 8 Dec 2024 16:46:50 -0800 Subject: [PATCH 2/2] clang-tidy: simplify some algorithms Signed-off-by: Rosen Penev --- pdns/arguments.cc | 2 +- pdns/dnsbulktest.cc | 3 +-- pdns/dnsrecords.cc | 6 +----- pdns/svc-records.hh | 5 +++++ 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pdns/arguments.cc b/pdns/arguments.cc index f87fa39b1d23..7eef549ded36 100644 --- a/pdns/arguments.cc +++ b/pdns/arguments.cc @@ -111,7 +111,7 @@ bool ArgvMap::contains(const string& var, const string& val) vector parts; stringtok(parts, param->second, ", \t"); - return std::any_of(parts.begin(), parts.end(), [&](const std::string& str) { return str == val; }); + return std::find(parts.begin(), parts.end(), val) != parts.end(); } string ArgvMap::helpstring(string prefix) diff --git a/pdns/dnsbulktest.cc b/pdns/dnsbulktest.cc index 49ad38ab49e4..9c9abd063d3a 100644 --- a/pdns/dnsbulktest.cc +++ b/pdns/dnsbulktest.cc @@ -317,8 +317,7 @@ try pos=split.second.find('/'); if(pos != string::npos) // alexa has whole urls in the list now. split.second.resize(pos); - if(find_if(split.second.begin(), split.second.end(), isalpha) == split.second.end()) - { + if (std::none_of(split.second.begin(), split.second.end(), isalpha)) { continue; // this was an IP address } domains.push_back(TypedQuery(split.second, qtype)); diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index 72311fd51ef8..9cabe90ff2f1 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -812,11 +812,7 @@ SvcParam SVCBBaseRecordContent::getParam(const SvcParam::SvcParamKey &key) const } set::const_iterator SVCBBaseRecordContent::getParamIt(const SvcParam::SvcParamKey &key) const { - auto p = std::find_if(d_params.begin(), d_params.end(), - [&key](const SvcParam ¶m) { - return param.getKey() == key; - }); - return p; + return std::find(d_params.begin(), d_params.end(), key); } std::shared_ptr SVCBRecordContent::clone() const diff --git a/pdns/svc-records.hh b/pdns/svc-records.hh index 19de2b9869e6..bd5530cef011 100644 --- a/pdns/svc-records.hh +++ b/pdns/svc-records.hh @@ -76,6 +76,11 @@ class SvcParam { bool operator< (const SvcParam &other) const; + bool operator==(const SvcParamKey& key) const + { + return key == d_key; + } + SvcParamKey getKey() const { return d_key; }