]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
clang-tidy: use default member init
authorRosen Penev <rosenp@gmail.com>
Tue, 10 Dec 2024 02:57:41 +0000 (18:57 -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>
19 files changed:
pdns/axfr-retriever.cc
pdns/axfr-retriever.hh
pdns/bindparserclasses.hh
pdns/comment.hh
pdns/dnswriter.cc
pdns/dnswriter.hh
pdns/inflighter.cc
pdns/logger.cc
pdns/logger.hh
pdns/mplexer.hh
pdns/rcpgenerator.cc
pdns/rcpgenerator.hh
pdns/signingpipe.cc
pdns/signingpipe.hh
pdns/webserver.cc
pdns/webserver.hh
pdns/ws-auth.cc
pdns/ws-auth.hh
pdns/zoneparser-tng.hh

index 6b87f5bd968f1437e618aeccd619f176d98b3b33..1c814f56d37c192ce395fb03b36337eccac864e2 100644 (file)
@@ -31,11 +31,11 @@ using pdns::resolver::parseResult;
 
 AXFRRetriever::AXFRRetriever(const ComboAddress& remote,
                              const DNSName& domain,
-                             const TSIGTriplet& tt, 
+                             const TSIGTriplet& tt,
                              const ComboAddress* laddr,
                              size_t maxReceivedBytes,
-                             uint16_t timeout)
-  : d_buf(65536), d_tsigVerifier(tt, remote, d_trc), d_receivedBytes(0), d_maxReceivedBytes(maxReceivedBytes)
+                             uint16_t timeout) :
+  d_buf(65536), d_tsigVerifier(tt, remote, d_trc), d_maxReceivedBytes(maxReceivedBytes)
 {
   ComboAddress local;
   if (laddr != nullptr) {
index 81362b754b5aa8fd8a21e56640cc376ab11677c1..18e37f6c5da4cf4ff6ff2c88fbb51c8d9eb285a8 100644 (file)
@@ -51,6 +51,6 @@ class AXFRRetriever : public boost::noncopyable
     TSIGRecordContent d_trc;
     TSIGTCPVerifier d_tsigVerifier;
 
-    size_t d_receivedBytes;
+    size_t d_receivedBytes{0};
     size_t d_maxReceivedBytes;
 };
index 1063de98ecb2216bd9e4ee8a7095ba9822dd1301..655367abdfefbfbd5b8518ac3e6d8f64d5fd9f5b 100644 (file)
@@ -32,9 +32,6 @@
 class BindDomainInfo 
 {
 public:
-  BindDomainInfo() : hadFileDirective(false), d_dev(0), d_ino(0)
-  {}
-
   void clear() 
   {
     name=DNSName();
@@ -50,10 +47,10 @@ public:
   vector<ComboAddress> primaries;
   set<string> alsoNotify;
   string type;
-  bool hadFileDirective;
-    
-  dev_t d_dev;
-  ino_t d_ino;
+  bool hadFileDirective{false};
+
+  dev_t d_dev{0};
+  ino_t d_ino{0};
 
   bool operator<(const BindDomainInfo& b) const
   {
@@ -66,14 +63,14 @@ extern FILE *yyin;
 class BindParser
 {
  public:
-  BindParser() : d_dir("."), d_verbose(false)
-  {
-    yyin=0;
-    extern int include_stack_ptr;
-    include_stack_ptr=0;
-    bind_directory=d_dir.c_str(); 
-  }
+   BindParser()
+   {
+     yyin = 0;
+     extern int include_stack_ptr;
+     include_stack_ptr = 0;
+
+     bind_directory = d_dir.c_str();
+   }
   ~BindParser()
   {
     if(yyin) {
@@ -90,9 +87,9 @@ class BindParser
   void addAlsoNotify(const string &host);
   set<string> & getAlsoNotify() { return this->alsoNotify; } 
 private:
-  string d_dir;
+  string d_dir{"."};
   typedef map<DNSName,string> zonedomain_t;
   set<string> alsoNotify;
   vector<BindDomainInfo> d_zonedomains;
-  bool d_verbose;
+  bool d_verbose{false};
 };
index 1608cffec816fd1a5387044fecb179472f8ce717..b121e1c5166f307d0d375598c83948c9ed4bea73 100644 (file)
 class Comment
 {
 public:
-  Comment() : modified_at(0), domain_id(0)  {};
-  ~Comment() = default;
-
   // data
   DNSName qname; //!< the name of the associated RRset, for example: www.powerdns.com
-  time_t modified_at;
+  time_t modified_at{0};
   string account; //!< account last updating this comment
   string content; //!< The actual comment. Example: blah blah
 
-  int domain_id;
+  int domain_id{0};
   QType qtype; //!< qtype of the associated RRset, ie A, CNAME, MX etc
 };
index 96a66a1a8bbe5034c55ecc84424cf9281b8451d7..5ee38dd75754d689042d3eafaaedbea74c762d8b 100644 (file)
@@ -40,9 +40,9 @@
 
 */
 
-
-template <typename Container> GenericDNSPacketWriter<Container>::GenericDNSPacketWriter(Container& content, const DNSName& qname, uint16_t  qtype, uint16_t qclass, uint8_t opcode)
-  : d_content(content), d_qname(qname), d_canonic(false), d_lowerCase(false)
+template <typename Container>
+GenericDNSPacketWriter<Container>::GenericDNSPacketWriter(Container& content, const DNSName& qname, uint16_t qtype, uint16_t qclass, uint8_t opcode) :
+  d_content(content), d_qname(qname)
 {
   d_content.clear();
   dnsheader dnsheader;
index adccd8365b6ee8f4c4f2758e25bd7450e64a29b1..14696df943f12150770b3e88944e1d4f6e1cfa06 100644 (file)
@@ -173,7 +173,7 @@ private:
 
   uint16_t d_truncatemarker; // end of header, for truncate
   DNSResourceRecord::Place d_recordplace;
-  bool d_canonic, d_lowerCase, d_compress{false};
+  bool d_canonic{false}, d_lowerCase{false}, d_compress{false};
 };
 
 using DNSPacketWriter = GenericDNSPacketWriter<std::vector<uint8_t>>;
index e770ea4c4aecfe7f3cc2090cb4909b9b8207983b..6bdc6d74b0e51507d5a9df105346c9ab1267fc83 100644 (file)
@@ -44,7 +44,8 @@ struct TimeTag{};
 template<typename Container, typename SenderReceiver> class Inflighter
 {
 public:
-  Inflighter(Container& c, SenderReceiver& sr) : d_container(c), d_sr(sr), d_init(false)
+  Inflighter(Container& c, SenderReceiver& sr) :
+    d_container(c), d_sr(sr)
   {
     d_burst = 2;
     d_maxInFlight = 5;
@@ -99,8 +100,8 @@ private:
   
   ttdwatch_t d_ttdWatch;
   typename Container::iterator d_iter;
-  bool d_init;
-  
+  bool d_init{false};
+
   uint64_t d_unexpectedResponse, d_timeouts;
 };
 
index c31651552deb364c50abcfd4d21d9744c152ca87..52a5f08f72fe632e1b24422cb8898a5aadbcb59f 100644 (file)
@@ -165,7 +165,7 @@ void Logger::setName(const string& _name)
 }
 
 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)
+  name(std::move(n)), flags(LOG_PID | LOG_NDELAY), d_facility(facility)
 {
   open();
 }
index 9a84661442c1d9597d9f4a272340faeabd425755..d1581809c4f313248142d246e52cf6b9fe84d655 100644 (file)
@@ -138,11 +138,8 @@ public:
 private:
   struct PerThread
   {
-    PerThread() :
-      d_urgency(Info)
-    {}
     string d_output;
-    Urgency d_urgency;
+    Urgency d_urgency{Info};
   };
   PerThread& getPerThread();
   void open();
@@ -151,10 +148,10 @@ private:
   string name;
   int flags;
   int d_facility;
-  Urgency d_loglevel;
-  Urgency consoleUrgency;
-  bool opened;
-  bool d_disableSyslog;
+  Urgency d_loglevel{Logger::None};
+  Urgency consoleUrgency{Error};
+  bool opened{false};
+  bool d_disableSyslog{false};
   bool d_timestamps{true};
   bool d_prefixed{false}; // this used to prefix the loglevel, but now causes formatting like structured logging
 };
index e23982d78552e39b4bd8566ca8122c7716812b54..3f22a4f85f372ce9a9b5516726d632a0e13a7938 100644 (file)
@@ -70,9 +70,6 @@ protected:
   };
 
 public:
-  FDMultiplexer() :
-    d_inrun(false)
-  {}
   virtual ~FDMultiplexer() = default;
 
   // The maximum number of events processed in a single run, not the maximum of watched descriptors
@@ -296,7 +293,7 @@ protected:
     callbackmap_t;
 
   callbackmap_t d_readCallbacks, d_writeCallbacks;
-  bool d_inrun;
+  bool d_inrun{false};
 
   void accountingAddFD(callbackmap_t& cbmap, int fd, callbackfunc_t toDo, const funcparam_t& parameter, const struct timeval* ttd)
   {
index fb5869dd126df3b85bfea24cfb51b46c0c814568..db5e48933c312321bfc934b721cba36b0facbd16 100644 (file)
@@ -36,7 +36,8 @@
 #include "base64.hh"
 #include "namespaces.hh"
 
-RecordTextReader::RecordTextReader(string  str, DNSName  zone) : d_string(std::move(str)), d_zone(std::move(zone)), d_pos(0)
+RecordTextReader::RecordTextReader(string str, DNSName zone) :
+  d_string(std::move(str)), d_zone(std::move(zone))
 {
    /* remove whitespace */
    if(!d_string.empty() && ( dns_isspace(*d_string.begin()) || dns_isspace(*d_string.rbegin()) ))
index a550177d51a25ff55a7caefdc08782d78d3838e4..914a353aa884bb7de35cd633926ce2b04550bb00 100644 (file)
@@ -77,7 +77,7 @@ public:
 private:
   string d_string;
   DNSName d_zone;
-  string::size_type d_pos;
+  string::size_type d_pos{0};
   string::size_type d_end;
   void skipSpaces();
 };
index 25f3d59b9f9783c02e31eb21db95cc994966f9b7..f2464c11b079318afa3d7356049b4b6aae567460 100644 (file)
@@ -59,9 +59,8 @@ catch(...) {
   return nullptr;
 }
 
-ChunkedSigningPipe::ChunkedSigningPipe(DNSName  signerName, bool mustSign, unsigned int workers, unsigned int maxChunkRecords)
-  : d_signed(0), d_queued(0), d_outstanding(0), d_numworkers(workers), d_submitted(0), d_signer(std::move(signerName)),
-    d_maxchunkrecords(maxChunkRecords), d_threads(d_numworkers), d_mustSign(mustSign), d_final(false)
+ChunkedSigningPipe::ChunkedSigningPipe(DNSName signerName, bool mustSign, unsigned int workers, unsigned int maxChunkRecords) :
+  d_signed(0), d_numworkers(workers), d_signer(std::move(signerName)), d_maxchunkrecords(maxChunkRecords), d_threads(d_numworkers), d_mustSign(mustSign)
 {
   d_rrsetToSign = make_unique<rrset_t>();
   d_chunks.push_back(vector<DNSZoneRecord>()); // load an empty chunk
index c72b541786412c4fcf45b5033cc948942ed2b696..d76ebda730c3aa29619879b21b019f38da3e986d 100644 (file)
@@ -49,8 +49,8 @@ public:
   unsigned int getReady() const;
 
   std::atomic<unsigned long> d_signed;
-  unsigned int d_queued;
-  unsigned int d_outstanding;
+  unsigned int d_queued{0};
+  unsigned int d_outstanding{0};
 
 private:
   void flushToSign();  
@@ -63,7 +63,7 @@ private:
   void worker(int fd);
 
   unsigned int d_numworkers;
-  unsigned int d_submitted;
+  unsigned int d_submitted{0};
 
   std::unique_ptr<rrset_t> d_rrsetToSign;
   std::deque< std::vector<DNSZoneRecord> > d_chunks;
@@ -77,5 +77,5 @@ private:
 
   vector<std::thread> d_threads;
   bool d_mustSign;
-  bool d_final;
+  bool d_final{false};
 };
index 58fb65c0ff1651ceea224a20e9a90c498044fab6..20213ce5cb79cbae2c8fa745b6c2ec78edc6c9e1 100644 (file)
@@ -587,8 +587,8 @@ WebServer::WebServer(string listenaddress, int port) :
   d_listenaddress(std::move(listenaddress)),
   d_port(port),
   d_server(nullptr),
-  d_maxbodysize(2*1024*1024),
-  d_connectiontimeout(5)
+  d_maxbodysize(2 * 1024 * 1024)
+
 {
     YaHTTP::Router::Map("OPTIONS", "/<*url>", [](YaHTTP::Request *req, YaHTTP::Response *resp) {
       // look for url in routes
index 5b83d70712e9251637dde47258b501da94a4ae39..8d5c42e75e162884563d339976c718ff647e1d47 100644 (file)
@@ -289,7 +289,7 @@ protected:
   std::unique_ptr<CredentialsHolder> d_webserverPassword{nullptr};
 
   ssize_t d_maxbodysize; // in bytes
-  int d_connectiontimeout; // in seconds
+  int d_connectiontimeout{5}; // in seconds
 
   NetmaskGroup d_acl;
 
index e0713e623ce3e084678fa3cbac5cea5d838a56e4..76c22e022f139718bd272dcaaf2e871670f71eb3 100644 (file)
@@ -101,10 +101,8 @@ static const std::set<uint16_t> atApexTypes = {QType::SOA, QType::DNSKEY};
 static const std::set<uint16_t> nonApexTypes = {QType::DS};
 
 AuthWebServer::AuthWebServer() :
-  d_start(time(nullptr)),
-  d_min10(0),
-  d_min5(0),
-  d_min1(0)
+  d_start(time(nullptr))
+
 {
   if (arg().mustDo("webserver") || arg().mustDo("api")) {
     d_ws = std::make_unique<WebServer>(arg()["webserver-address"], arg().asNum("webserver-port"));
index 4eb539e76544003082f79446ddfe62bd7ee0126e..f456ed37a84b82f6b6d44abaa4c0d1e698de4869 100644 (file)
@@ -61,7 +61,7 @@ private:
   void statThread(StatBag& stats);
 
   time_t d_start;
-  double d_min10, d_min5, d_min1;
+  double d_min10{0}, d_min5{0}, d_min1{0};
   Ewma d_queries, d_cachehits, d_cachemisses;
   Ewma d_qcachehits, d_qcachemisses;
   unique_ptr<WebServer> d_ws{nullptr};
index b50e86ec6658eb96141af70e220c8c3cbcc80fe3..977fcb768210ae1c831556098f75df6163eecbb1 100644 (file)
@@ -60,10 +60,11 @@ private:
   unsigned makeTTLFromZone(const std::string& str);
 
   struct filestate {
-    filestate(FILE* fp, string filename) : d_fp(fp), d_filename(std::move(filename)), d_lineno(0){}
+    filestate(FILE* fp, string filename) :
+      d_fp(fp), d_filename(std::move(filename)) {}
     FILE *d_fp;
     string d_filename;
-    int d_lineno;
+    int d_lineno{0};
   };
 
   parts_t d_parts;