Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy: simplify some algorithms #14948

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions m4/boost.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion modules/lua2backend/lua2api2.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion pdns/arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ bool ArgvMap::contains(const string& var, const string& val)
vector<string> 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)
Expand Down
3 changes: 1 addition & 2 deletions pdns/dnsbulktest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 0 additions & 2 deletions pdns/dnsdistdist/dnsdist-lua-bindings-packetcache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include "dnsdist-cache.hh"
#include "dnsdist-lua.hh"

#include <boost/lexical_cast.hpp>

void setupLuaBindingsPacketCache(LuaContext& luaCtx, bool client)
{
/* PacketCache */
Expand Down
6 changes: 1 addition & 5 deletions pdns/dnsrecords.cc
Original file line number Diff line number Diff line change
Expand Up @@ -812,11 +812,7 @@ SvcParam SVCBBaseRecordContent::getParam(const SvcParam::SvcParamKey &key) const
}

set<SvcParam>::const_iterator SVCBBaseRecordContent::getParamIt(const SvcParam::SvcParamKey &key) const {
auto p = std::find_if(d_params.begin(), d_params.end(),
[&key](const SvcParam &param) {
return param.getKey() == key;
});
return p;
return std::find(d_params.begin(), d_params.end(), key);
}

std::shared_ptr<SVCBBaseRecordContent> SVCBRecordContent::clone() const
Expand Down
5 changes: 5 additions & 0 deletions pdns/svc-records.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading