From 1290c1d2423acd272c8315b25c234de80f1f86c7 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 4 Feb 2021 17:16:52 -0800 Subject: [PATCH] clang-tidy: pass by value and use std::move Found with modernize-pass-by-value Signed-off-by: Rosen Penev --- modules/gmysqlbackend/smysql.cc | 6 +++--- modules/gmysqlbackend/smysql.hh | 6 +++--- pdns/dnsrecords.cc | 10 +++++----- pdns/dnsrecords.hh | 6 +++--- pdns/logger.cc | 4 ++-- pdns/logger.hh | 2 +- pdns/rcpgenerator.cc | 2 +- pdns/rcpgenerator.hh | 2 +- pdns/signingpipe.cc | 4 ++-- pdns/signingpipe.hh | 2 +- pdns/webserver.cc | 4 ++-- pdns/webserver.hh | 2 +- pdns/zoneparser-tng.cc | 8 ++++---- pdns/zoneparser-tng.hh | 4 ++-- 14 files changed, 31 insertions(+), 31 deletions(-) diff --git a/modules/gmysqlbackend/smysql.cc b/modules/gmysqlbackend/smysql.cc index b889970ec7..e813e516c5 100644 --- a/modules/gmysqlbackend/smysql.cc +++ b/modules/gmysqlbackend/smysql.cc @@ -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(); } diff --git a/modules/gmysqlbackend/smysql.hh b/modules/gmysqlbackend/smysql.hh index 50780e9c51..230440faf3 100644 --- a/modules/gmysqlbackend/smysql.hh +++ b/modules/gmysqlbackend/smysql.hh @@ -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); diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index b07a1a2aa9..dd63743051 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -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) { } diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index 018fba3059..d7ee6274d6 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -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; diff --git a/pdns/logger.cc b/pdns/logger.cc index 6804b39979..7d920f576f 100644 --- a/pdns/logger.cc +++ b/pdns/logger.cc @@ -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(); diff --git a/pdns/logger.hh b/pdns/logger.hh index e8c4da7019..f6a5af475e 100644 --- a/pdns/logger.hh +++ b/pdns/logger.hh @@ -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, diff --git a/pdns/rcpgenerator.cc b/pdns/rcpgenerator.cc index b1d849aeae..c9cd1afa3d 100644 --- a/pdns/rcpgenerator.cc +++ b/pdns/rcpgenerator.cc @@ -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()) )) diff --git a/pdns/rcpgenerator.hh b/pdns/rcpgenerator.hh index cd0ae80832..d824dac865 100644 --- a/pdns/rcpgenerator.hh +++ b/pdns/rcpgenerator.hh @@ -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); diff --git a/pdns/signingpipe.cc b/pdns/signingpipe.cc index ca0e288f25..020011ce47 100644 --- a/pdns/signingpipe.cc +++ b/pdns/signingpipe.cc @@ -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(); diff --git a/pdns/signingpipe.hh b/pdns/signingpipe.hh index 301e2f4ebe..4c6443342f 100644 --- a/pdns/signingpipe.hh +++ b/pdns/signingpipe.hh @@ -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); diff --git a/pdns/webserver.cc b/pdns/webserver.cc index ffc36baebd..26633811c0 100644 --- a/pdns/webserver.cc +++ b/pdns/webserver.cc @@ -449,8 +449,8 @@ void WebServer::serveConnection(const std::shared_ptr& 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) diff --git a/pdns/webserver.hh b/pdns/webserver.hh index 7917b93af1..858b56e9eb 100644 --- a/pdns/webserver.hh +++ b/pdns/webserver.hh @@ -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) { diff --git a/pdns/zoneparser-tng.cc b/pdns/zoneparser-tng.cc index 7a11aae2c8..c769626997 100644 --- a/pdns/zoneparser-tng.cc +++ b/pdns/zoneparser-tng.cc @@ -39,16 +39,16 @@ 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& zonedata, const DNSName& zname, bool upgradeContent): - d_zonename(zname), d_zonedata(zonedata), d_defaultttl(3600), +ZoneParserTNG::ZoneParserTNG(const vector& 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) { diff --git a/pdns/zoneparser-tng.hh b/pdns/zoneparser-tng.hh index 6653310754..a15f7630a6 100644 --- a/pdns/zoneparser-tng.hh +++ b/pdns/zoneparser-tng.hh @@ -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& zonedata, const DNSName& zname, bool upgradeContent=false); + ZoneParserTNG(const string& fname, DNSName zname=g_rootdnsname, string reldir="", bool upgradeContent=false); + ZoneParserTNG(const vector& zonedata, DNSName zname, bool upgradeContent=false); ~ZoneParserTNG(); bool get(DNSResourceRecord& rr, std::string* comment=0); -- 2.47.2