]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
clang-tidy: pass by value and use std::move
authorRosen Penev <rosenp@gmail.com>
Fri, 5 Feb 2021 01:16:52 +0000 (17:16 -0800)
committerRosen Penev <rosenp@gmail.com>
Fri, 5 Feb 2021 01:27:39 +0000 (17:27 -0800)
Found with modernize-pass-by-value

Signed-off-by: Rosen Penev <rosenp@gmail.com>
14 files changed:
modules/gmysqlbackend/smysql.cc
modules/gmysqlbackend/smysql.hh
pdns/dnsrecords.cc
pdns/dnsrecords.hh
pdns/logger.cc
pdns/logger.hh
pdns/rcpgenerator.cc
pdns/rcpgenerator.hh
pdns/signingpipe.cc
pdns/signingpipe.hh
pdns/webserver.cc
pdns/webserver.hh
pdns/zoneparser-tng.cc
pdns/zoneparser-tng.hh

index b889970ec727e64fb80801e6fbe6248971803cda..e813e516c5e84a73b71e5accb91d8454f8077c60 100644 (file)
@@ -491,9 +491,9 @@ void SMySQL::connect()
   } while (retry >= 0);
 }
 
-SMySQL::SMySQL(const string &database, const string &host, uint16_t port, const string &msocket, const string &user,
-               const string &password, const string &group, bool setIsolation, unsigned int timeout, bool threadCleanup, bool clientSSL):
-  d_database(database), d_host(host), d_msocket(msocket), d_user(user), d_password(password), d_group(group), d_timeout(timeout), d_port(port), d_setIsolation(setIsolation), d_threadCleanup(threadCleanup), d_clientSSL(clientSSL)
+SMySQL::SMySQL(string database, string host, uint16_t port, string msocket, string user,
+               string password, string group, bool setIsolation, unsigned int timeout, bool threadCleanup, bool clientSSL):
+  d_database(std::move(database)), d_host(std::move(host)), d_msocket(std::move(msocket)), d_user(std::move(user)), d_password(std::move(password)), d_group(std::move(group)), d_timeout(timeout), d_port(port), d_setIsolation(setIsolation), d_threadCleanup(threadCleanup), d_clientSSL(clientSSL)
 {
   connect();
 }
index 50780e9c51a1957a68fe00acfda103040f5f44d5..230440faf3367d809d99b7fca9fcb88f07a4a49e 100644 (file)
@@ -29,9 +29,9 @@
 class SMySQL : public SSql
 {
 public:
-  SMySQL(const string &database, const string &host="", uint16_t port=0,
-         const string &msocket="",const string &user="",
-         const string &password="", const string &group="",
+  SMySQL(string database, string host="", uint16_t port=0,
+         string msocket="",string user="",
+         string password="", string group="",
          bool setIsolation=false, unsigned int timeout=10,
          bool threadCleanup=false, bool clientSSL=false);
 
index b07a1a2aa9e22b5a0f41ef498c00c94934dface8..dd637430513e23175b321c54d01258d0c0bd3f06 100644 (file)
@@ -208,7 +208,7 @@ boilerplate_conv(TSIG, QType::TSIG,
                  if (size>0) conv.xfrBlobNoSpaces(d_otherData, size);
                  );
 
-MXRecordContent::MXRecordContent(uint16_t preference, const DNSName& mxname):  d_preference(preference), d_mxname(mxname)
+MXRecordContent::MXRecordContent(uint16_t preference, DNSName  mxname):  d_preference(preference), d_mxname(std::move(mxname))
 {
 }
 
@@ -274,8 +274,8 @@ boilerplate_conv(NAPTR, QType::NAPTR,
                  )
 
 
-SRVRecordContent::SRVRecordContent(uint16_t preference, uint16_t weight, uint16_t port, const DNSName& target) 
-: d_weight(weight), d_port(port), d_target(target), d_preference(preference)
+SRVRecordContent::SRVRecordContent(uint16_t preference, uint16_t weight, uint16_t port, DNSName  target) 
+: d_weight(weight), d_port(port), d_target(std::move(target)), d_preference(preference)
 {}
 
 boilerplate_conv(SRV, QType::SRV, 
@@ -283,8 +283,8 @@ boilerplate_conv(SRV, QType::SRV,
                  conv.xfrName(d_target); 
                  )
 
-SOARecordContent::SOARecordContent(const DNSName& mname, const DNSName& rname, const struct soatimes& st) 
-: d_mname(mname), d_rname(rname), d_st(st)
+SOARecordContent::SOARecordContent(DNSName  mname, DNSName  rname, const struct soatimes& st) 
+: d_mname(std::move(mname)), d_rname(std::move(rname)), d_st(st)
 {
 }
 
index 018fba30594f70f003b009fcf3cd36045a2a294f..d7ee6274d68077a5dbc4c8c03b288706e22e18cc 100644 (file)
@@ -96,7 +96,7 @@ private:
 class MXRecordContent : public DNSRecordContent
 {
 public:
-  MXRecordContent(uint16_t preference, const DNSName& mxname);
+  MXRecordContent(uint16_t preference, DNSName  mxname);
 
   includeboilerplate(MX)
 
@@ -153,7 +153,7 @@ private:
 class SRVRecordContent : public DNSRecordContent
 {
 public:
-  SRVRecordContent(uint16_t preference, uint16_t weight, uint16_t port, const DNSName& target);
+  SRVRecordContent(uint16_t preference, uint16_t weight, uint16_t port, DNSName  target);
 
   includeboilerplate(SRV)
 
@@ -562,7 +562,7 @@ class SOARecordContent : public DNSRecordContent
 {
 public:
   includeboilerplate(SOA)
-  SOARecordContent(const DNSName& mname, const DNSName& rname, const struct soatimes& st);
+  SOARecordContent(DNSName  mname, DNSName  rname, const struct soatimes& st);
 
   DNSName d_mname;
   DNSName d_rname;
index 6804b3997959e6b72eff16601cda998f0a48cb1b..7d920f576f2579f72d40dd3e8671b48ab4227bdf 100644 (file)
@@ -149,8 +149,8 @@ void Logger::setName(const string &_name)
   open();
 }
 
-Logger::Logger(const string &n, int facility) :
-  name(n), flags(LOG_PID|LOG_NDELAY), d_facility(facility), d_loglevel(Logger::None),
+Logger::Logger(string n, int facility) :
+  name(std::move(n)), flags(LOG_PID|LOG_NDELAY), d_facility(facility), d_loglevel(Logger::None),
   consoleUrgency(Error), opened(false), d_disableSyslog(false)
 {
   open();
index e8c4da7019f769c779d354f0d8377f87e5c18666..f6a5af475ec07b6aca3f8028b9c1d85a21cc2de6 100644 (file)
@@ -35,7 +35,7 @@
 class Logger
 {
 public:
-  Logger(const string &, int facility=LOG_DAEMON); //!< pass the identification you wish to appear in the log
+  Logger(string , int facility=LOG_DAEMON); //!< pass the identification you wish to appear in the log
 
   //! The urgency of a log message
   enum Urgency {All=32767,Alert=LOG_ALERT, Critical=LOG_CRIT, Error=LOG_ERR, Warning=LOG_WARNING,
index b1d849aeaea6d83f6fc46543e9e5d953332814ab..c9cd1afa3deaf17b60a00b4009ab0c5d10af558e 100644 (file)
@@ -35,7 +35,7 @@
 #include "base64.hh"
 #include "namespaces.hh"
 
-RecordTextReader::RecordTextReader(const string& str, const DNSName& zone) : d_string(str), d_zone(zone), d_pos(0)
+RecordTextReader::RecordTextReader(string  str, DNSName  zone) : d_string(std::move(str)), d_zone(std::move(zone)), d_pos(0)
 {
    /* remove whitespace */
    if(!d_string.empty() && ( dns_isspace(*d_string.begin()) || dns_isspace(*d_string.rbegin()) ))
index cd0ae80832a61fee1636790a30384628b3f8c027..d824dac8652f5bcbe2b55005dff93dfe2c994855 100644 (file)
@@ -39,7 +39,7 @@ public:
 class RecordTextReader
 {
 public:
-  RecordTextReader(const string& str, const DNSName& zone=DNSName(""));
+  RecordTextReader(string  str, DNSName  zone=DNSName(""));
   void xfr64BitInt(uint64_t& val);
   void xfr48BitInt(uint64_t& val);
   void xfr32BitInt(uint32_t& val);
index ca0e288f25fc11955d46036fdfde4a4904f5bb9c..020011ce475ebc46446daa3d34628819cf7b013f 100644 (file)
@@ -56,8 +56,8 @@ catch(...) {
   return nullptr;
 }
 
-ChunkedSigningPipe::ChunkedSigningPipe(const DNSName& signerName, bool mustSign, unsigned int workers)
-  : d_signed(0), d_queued(0), d_outstanding(0), d_numworkers(workers), d_submitted(0), d_signer(signerName),
+ChunkedSigningPipe::ChunkedSigningPipe(DNSName  signerName, bool mustSign, unsigned int workers)
+  : d_signed(0), d_queued(0), d_outstanding(0), d_numworkers(workers), d_submitted(0), d_signer(std::move(signerName)),
     d_maxchunkrecords(100), d_threads(d_numworkers), d_mustSign(mustSign), d_final(false)
 {
   d_rrsetToSign = make_unique<rrset_t>();
index 301e2f4ebe74d51562cb460ffd750eb66a5b0885..4c6443342fa8d025ca4f28ee442aed42918aff33 100644 (file)
@@ -42,7 +42,7 @@ public:
   
   ChunkedSigningPipe(const ChunkedSigningPipe&) = delete;
   void operator=(const ChunkedSigningPipe&) = delete;
-  ChunkedSigningPipe(const DNSName& signerName, bool mustSign, unsigned int numWorkers=3);
+  ChunkedSigningPipe(DNSName  signerName, bool mustSign, unsigned int numWorkers=3);
   ~ChunkedSigningPipe();
   bool submit(const DNSZoneRecord& rr);
   chunk_t getChunk(bool final=false);
index ffc36baebd5a36e5c711d0a7d4ef284b6a5babac..26633811c0b93e278e73de3ab9796b232c79d4b9 100644 (file)
@@ -449,8 +449,8 @@ void WebServer::serveConnection(const std::shared_ptr<Socket>& client) const {
   }
 }
 
-WebServer::WebServer(const string &listenaddress, int port) :
-  d_listenaddress(listenaddress),
+WebServer::WebServer(string listenaddress, int port) :
+  d_listenaddress(std::move(listenaddress)),
   d_port(port),
   d_server(nullptr),
   d_maxbodysize(2*1024*1024)
index 7917b93af1a0031a6784c6c18b2fd0f3b68edc6d..858b56e9eb7770981008d3a3e95d5352a80adcd6 100644 (file)
@@ -156,7 +156,7 @@ protected:
 class WebServer : public boost::noncopyable
 {
 public:
-  WebServer(const string &listenaddress, int port);
+  WebServer(string listenaddress, int port);
   virtual ~WebServer() { };
 
   void setApiKey(const string &apikey) {
index 7a11aae2c8803b85074217817cdd6c9fd96a032a..c769626997a03d34d0f1c4268b9dbb8eecd3ee73 100644 (file)
 
 static string g_INstr("IN");
 
-ZoneParserTNG::ZoneParserTNG(const string& fname, const DNSName& zname, const string& reldir, bool upgradeContent):
-  d_reldir(reldir), d_zonename(zname), d_defaultttl(3600), 
+ZoneParserTNG::ZoneParserTNG(const string& fname, DNSName  zname, string  reldir, bool upgradeContent):
+  d_reldir(std::move(reldir)), d_zonename(std::move(zname)), d_defaultttl(3600), 
   d_templatecounter(0), d_templatestop(0), d_templatestep(0),
   d_havedollarttl(false), d_fromfile(true), d_upgradeContent(upgradeContent)
 {
   stackFile(fname);
 }
 
-ZoneParserTNG::ZoneParserTNG(const vector<string>& zonedata, const DNSName& zname, bool upgradeContent):
-  d_zonename(zname), d_zonedata(zonedata), d_defaultttl(3600),
+ZoneParserTNG::ZoneParserTNG(const vector<string>& zonedata, DNSName  zname, bool upgradeContent):
+  d_zonename(std::move(zname)), d_zonedata(zonedata), d_defaultttl(3600),
   d_templatecounter(0), d_templatestop(0), d_templatestep(0),
   d_havedollarttl(false), d_fromfile(false), d_upgradeContent(upgradeContent)
 {
index 6653310754226ce10e4a3e70b878b5c051a3ba4f..a15f7630a64593e21f3def9cdea3f0545b89a5a8 100644 (file)
@@ -31,8 +31,8 @@
 class ZoneParserTNG
 {
 public:
-  ZoneParserTNG(const string& fname, const DNSName& zname=g_rootdnsname, const string& reldir="", bool upgradeContent=false);
-  ZoneParserTNG(const vector<string>& zonedata, const DNSName& zname, bool upgradeContent=false);
+  ZoneParserTNG(const string& fname, DNSName  zname=g_rootdnsname, string  reldir="", bool upgradeContent=false);
+  ZoneParserTNG(const vector<string>& zonedata, DNSName  zname, bool upgradeContent=false);
 
   ~ZoneParserTNG();
   bool get(DNSResourceRecord& rr, std::string* comment=0);