]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
clang-tidy: pass by value
authorRosen Penev <rosenp@gmail.com>
Mon, 20 Jan 2025 03:29:30 +0000 (19:29 -0800)
committerRosen Penev <rosenp@gmail.com>
Wed, 22 Jan 2025 00:16:56 +0000 (16:16 -0800)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
pdns/communicator.hh
pdns/dnsbackend.hh
pdns/dnsname.hh
pdns/dnsrecords.hh
pdns/lua-base4.hh
pdns/misc.hh
pdns/pdnsexception.hh
pdns/webserver.hh

index 768b8dee716df650d726c493317b6849a45ed492..4fba795a508467967a99dec2b40986528e23682b 100644 (file)
@@ -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>
@@ -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()
index 7b7e4c211784f078cef053a85636bacc07afd592..07e99388ae047213d8c60221d5b440c1a334dcd3 100644 (file)
@@ -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)
index ccf8eb004de6f2d3f0d2ed8596314a91b06983c5..398c27c9d31560f5e7f31be6e35b9fc2943ef90d 100644 (file)
@@ -24,6 +24,7 @@
 #include <cstring>
 #include <optional>
 #include <string>
+#include <utility>
 #include <vector>
 #include <set>
 #include <strings.h>
@@ -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)
index 1913bfa501983c9c76ac5eb64bf2e30f0b9f3065..7bddcc2b6d6fd79e563f6c8431ebbb890cc338a8 100644 (file)
@@ -30,6 +30,7 @@
 #include "rcpgenerator.hh"
 #include <set>
 #include <bitset>
+#include <utility>
 #include "namespaces.hh"
 #include "iputils.hh"
 #include "svc-records.hh"
@@ -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
   {
@@ -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
   {
@@ -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
   {
@@ -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
   {
index 1786d0ff78ccc9500e1b8df1c6ce9f72c14be9b2..884921817b5dc6cd5d6fb7a9d89c3580768cca23 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 #include "namespaces.hh"
 #include <boost/variant/variant.hpp>
+#include <utility>
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -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);
index 66dd0ccf3e33a85fc02ef1c360525077138e4f4d..1082b47c5ad6101372e726c43d3c1313ed142526 100644 (file)
@@ -39,6 +39,7 @@
 #include <stdexcept>
 #include <string>
 #include <cctype>
+#include <utility>
 #include <vector>
 
 #include "namespaces.hh"
@@ -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)
   {
   }
 
index 8960816b709f189f9dbd7fd5a6d5b544188e9b3e..3417fe177bd4af7a945325cb14433c2f07fd8ba3 100644 (file)
@@ -21,6 +21,7 @@
  */
 #pragma once
 #include<string>
+#include <utility>
 
 #include "namespaces.hh"
 
@@ -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
 };
 
index 8d5c42e75e162884563d339976c718ff647e1d47..e1f3795f691239afce933ca2a2fdcbc421cabd2c 100644 (file)
@@ -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
 
@@ -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};