]> granicus.if.org Git - pdns/commitdiff
Use an initialization list instead of assigning values in the ctor body
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 27 Mar 2018 12:28:01 +0000 (14:28 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 27 Mar 2018 12:28:01 +0000 (14:28 +0200)
pdns/dnsdist.hh
pdns/dnsname.hh
pdns/dnsparser.cc
pdns/iputils.hh

index 862efa60b5ac51a3890bbd5f7f1f16c3bb87d8bf..c4650c233cbeb62f106eeaf25f473cce6b8a115e 100644 (file)
@@ -128,6 +128,19 @@ public:
 
 struct DynBlock
 {
+  DynBlock(): action(DNSAction::Action::None)
+  {
+  }
+
+  DynBlock(const std::string& reason_, const struct timespec& until_, const DNSName& domain_, DNSAction::Action action_): reason(reason_), until(until_), domain(domain_), action(action_)
+  {
+  }
+
+  DynBlock(const DynBlock& rhs): reason(rhs.reason), until(rhs.until), domain(rhs.domain), action(rhs.action)
+  {
+    blocks.store(rhs.blocks);
+  }
+
   DynBlock& operator=(const DynBlock& rhs)
   {
     reason=rhs.reason;
@@ -324,12 +337,10 @@ struct ClientState;
 struct IDState
 {
   IDState() : origFD(-1), sentTime(true), delayMsec(0), tempFailureTTL(boost::none) { origDest.sin4.sin_family = 0;}
-  IDState(const IDState& orig)
+  IDState(const IDState& orig): origRemote(orig.origRemote), origDest(orig.origDest)
   {
     origFD = orig.origFD;
     origID = orig.origID;
-    origRemote = orig.origRemote;
-    origDest = orig.origDest;
     delayMsec = orig.delayMsec;
     tempFailureTTL = orig.tempFailureTTL;
     age.store(orig.age.load());
index 7307da4edd6b7f66bedc679954d6a1b688740f34..7e0419f3142cad16edf0e0371a482f010bb1d5a0 100644 (file)
@@ -179,9 +179,7 @@ inline bool DNSName::canonCompare(const DNSName& rhs) const
   for(;;) {
     if(ourcount == 0 && rhscount != 0)
       return true;
-    if(ourcount == 0 && rhscount == 0)
-      return false;
-    if(ourcount !=0 && rhscount == 0)
+    if(rhscount == 0)
       return false;
     ourcount--;
     rhscount--;
@@ -235,12 +233,8 @@ struct SuffixMatchTree
   SuffixMatchTree(const std::string& name="", bool endNode_=false) : d_name(name), endNode(endNode_)
   {}
 
-  SuffixMatchTree(const SuffixMatchTree& rhs)
+  SuffixMatchTree(const SuffixMatchTree& rhs): d_name(rhs.d_name), children(rhs.children), endNode(rhs.endNode), d_value(rhs.d_value)
   {
-    d_name = rhs.d_name;
-    children = rhs.children;
-    endNode = rhs.endNode;
-    d_value = rhs.d_value;
   }
   std::string d_name;
   mutable std::set<SuffixMatchTree> children;
index dfee6c399680e12d396e9a9a6e2cf50fc9c36b5f..805600dfcd4a9c7d46e0e6e04db0f5e33e82b887 100644 (file)
@@ -199,9 +199,8 @@ DNSRecordContent::zmakermap_t& DNSRecordContent::getZmakermap()
   return zmakermap;
 }
 
-DNSRecord::DNSRecord(const DNSResourceRecord& rr)
+DNSRecord::DNSRecord(const DNSResourceRecord& rr): d_name(rr.qname)
 {
-  d_name = rr.qname;
   d_type = rr.qtype.getCode();
   d_ttl = rr.ttl;
   d_class = rr.qclass;
index b80aa800f344417d348c2ed39255d7e75c0d72ec..1b8d7f84380d5e5773fa08f43fd4dd504a920b0b 100644 (file)
@@ -349,9 +349,8 @@ public:
        d_bits=0;
   }
   
-  Netmask(const ComboAddress& network, uint8_t bits=0xff)
+  Netmask(const ComboAddress& network, uint8_t bits=0xff): d_network(network)
   {
-    d_network = network;
     d_network.sin4.sin_port=0;
     if(bits > 128)
       bits = (network.sin4.sin_family == AF_INET) ? 32 : 128;
@@ -601,6 +600,7 @@ public:
     // see above.
     for(auto const& node: rhs._nodes)
       insert(node->first).second = node->second;
+    d_cleanup_tree = rhs.d_cleanup_tree;
     return *this;
   }