Skip to content

Commit

Permalink
clang-tidy: pass by value
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Jan 22, 2025
1 parent 6c0f3bc commit f948cdd
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 16 deletions.
5 changes: 3 additions & 2 deletions pdns/communicator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <utility>
using namespace boost::multi_index;

#include <unistd.h>
Expand Down Expand Up @@ -234,8 +235,8 @@ private:

struct RemoveSentinel
{
explicit RemoveSentinel(const DNSName& dn, CommunicatorClass* cc) :
d_dn(dn), d_cc(cc)
explicit RemoveSentinel(DNSName dn, CommunicatorClass* cc) :
d_dn(std::move(dn)), d_cc(cc)
{}

~RemoveSentinel()
Expand Down
4 changes: 2 additions & 2 deletions pdns/dnsbackend.hh
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ private:
class BackendFactory
{
public:
BackendFactory(const string& name) :
d_name(name) {}
BackendFactory(string name) :
d_name(std::move(name)) {}
virtual ~BackendFactory() = default;
virtual DNSBackend* make(const string& suffix) = 0;
virtual DNSBackend* makeMetadataOnly(const string& suffix)
Expand Down
4 changes: 3 additions & 1 deletion pdns/dnsname.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <cstring>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <strings.h>
Expand Down Expand Up @@ -306,7 +307,8 @@ extern const DNSName g_rootdnsname, g_wildcarddnsname;
template<typename T>
struct SuffixMatchTree
{
SuffixMatchTree(const std::string& name="", bool endNode_=false) : d_name(name), endNode(endNode_)
SuffixMatchTree(std::string name = "", bool endNode_ = false) :
d_name(std::move(name)), endNode(endNode_)
{}

SuffixMatchTree(const SuffixMatchTree& rhs): d_name(rhs.d_name), children(rhs.children), endNode(rhs.endNode)
Expand Down
15 changes: 9 additions & 6 deletions pdns/dnsrecords.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "rcpgenerator.hh"
#include <set>
#include <bitset>
#include <utility>
#include "namespaces.hh"
#include "iputils.hh"
#include "svc-records.hh"
Expand Down Expand Up @@ -289,8 +290,8 @@ private:
class NSRecordContent : public DNSRecordContent
{
public:
includeboilerplate(NS)
explicit NSRecordContent(const DNSName& content) : d_content(content){}
includeboilerplate(NS) explicit NSRecordContent(DNSName content) :
d_content(std::move(content)) {}
const DNSName& getNS() const { return d_content; }
bool operator==(const DNSRecordContent& rhs) const override
{
Expand All @@ -310,8 +311,8 @@ private:
class PTRRecordContent : public DNSRecordContent
{
public:
includeboilerplate(PTR)
explicit PTRRecordContent(const DNSName& content) : d_content(content){}
includeboilerplate(PTR) explicit PTRRecordContent(DNSName content) :
d_content(std::move(content)) {}
const DNSName& getContent() const { return d_content; }
[[nodiscard]] size_t sizeEstimate() const override
{
Expand All @@ -325,7 +326,8 @@ class CNAMERecordContent : public DNSRecordContent
{
public:
includeboilerplate(CNAME)
CNAMERecordContent(const DNSName& content) : d_content(content){}
CNAMERecordContent(DNSName content) :
d_content(std::move(content)) {}
DNSName getTarget() const { return d_content; }
[[nodiscard]] size_t sizeEstimate() const override
{
Expand Down Expand Up @@ -358,7 +360,8 @@ class DNAMERecordContent : public DNSRecordContent
{
public:
includeboilerplate(DNAME)
DNAMERecordContent(const DNSName& content) : d_content(content){}
DNAMERecordContent(DNSName content) :
d_content(std::move(content)) {}
const DNSName& getTarget() const { return d_content; }
[[nodiscard]] size_t sizeEstimate() const override
{
Expand Down
4 changes: 3 additions & 1 deletion pdns/lua-base4.hh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include "namespaces.hh"
#include <boost/variant/variant.hpp>
#include <utility>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Expand All @@ -13,7 +14,8 @@ protected:
std::string d_include_path; // path where scripts to include at postLoad are

public:
BaseLua4(const std::string &includePath) : d_include_path(includePath) {};
BaseLua4(std::string includePath) :
d_include_path(std::move(includePath)) {};
void loadFile(const std::string &fname, bool doPostLoad=true);
void loadString(const std::string &script);
void loadStream(std::istream &stream, bool doPostLoad=true);
Expand Down
4 changes: 3 additions & 1 deletion pdns/misc.hh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <stdexcept>
#include <string>
#include <cctype>
#include <utility>
#include <vector>

#include "namespaces.hh"
Expand Down Expand Up @@ -528,7 +529,8 @@ private:
class SimpleMatch
{
public:
SimpleMatch(const string &mask, bool caseFold = false): d_mask(mask), d_fold(caseFold)
SimpleMatch(string mask, bool caseFold = false) :
d_mask(std::move(mask)), d_fold(caseFold)
{
}

Expand Down
6 changes: 4 additions & 2 deletions pdns/pdnsexception.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
#pragma once
#include<string>
#include <utility>

#include "namespaces.hh"

Expand All @@ -29,8 +30,9 @@ class PDNSException
{
public:
PDNSException() : reason("Unspecified") {};
PDNSException(const string& r) : reason(r) {};

PDNSException(string r) :
reason(std::move(r)) {};

string reason; //! Print this to tell the user what went wrong
};

Expand Down
4 changes: 3 additions & 1 deletion pdns/webserver.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <boost/utility.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#include <utility>
#include <yahttp/yahttp.hpp>
#pragma GCC diagnostic pop

Expand All @@ -38,7 +39,8 @@

class HttpRequest : public YaHTTP::Request {
public:
HttpRequest(const string& logprefix_="") : YaHTTP::Request(), logprefix(logprefix_) { };
HttpRequest(string logprefix_ = "") :
YaHTTP::Request(), logprefix(std::move(logprefix_)) {};

string logprefix;
bool accept_yaml{false};
Expand Down

0 comments on commit f948cdd

Please sign in to comment.