]> granicus.if.org Git - pdns/commitdiff
Cleanup copy constructor/assignment op "rule-of-2" violations.
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 30 Sep 2019 09:46:13 +0000 (11:46 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 1 Oct 2019 06:55:18 +0000 (08:55 +0200)
pdns/dnsname.hh
pdns/dnspacket.cc
pdns/dnspacket.hh
pdns/misc.cc
pdns/misc.hh
pdns/resolve-context.hh
pdns/syncres.hh

index 68d17f7c485d1e6ee7a7bcd00f01831e6759c785..da6c4de46471d27f02af5e0a2dbd6506a1d981b6 100644 (file)
@@ -242,6 +242,17 @@ struct SuffixMatchTree
       d_value = rhs.d_value;
     }
   }
+  SuffixMatchTree & operator=(const SuffixMatchTree &rhs)
+  {
+    d_name = rhs.d_name;
+    children = rhs.children;
+    endNode = rhs.endNode;
+    if (endNode) {
+      d_value = rhs.d_value;
+    }
+    return *this;
+  }
+  
   std::string d_name;
   mutable std::set<SuffixMatchTree> children;
   mutable bool endNode;
index 37d14249347e21b64c33e1501d0e1553e1fd01f0..980770ff7ec121e239ded506fe92efd7867456e5 100644 (file)
@@ -77,49 +77,6 @@ uint16_t DNSPacket::getRemotePort() const
   return d_remote.sin4.sin_port;
 }
 
-DNSPacket::DNSPacket(const DNSPacket &orig) :
-  d_anyLocal(orig.d_anyLocal),
-  d_dt(orig.d_dt),
-  qdomain(orig.qdomain),
-  qdomainwild(orig.qdomainwild),
-  qdomainzone(orig.qdomainzone),
-
-  d(orig.d),
-  d_trc(orig.d_trc),
-  d_remote(orig.d_remote),
-  d_tsig_algo(orig.d_tsig_algo),
-
-  d_ednsRawPacketSizeLimit(orig.d_ednsRawPacketSizeLimit),
-  qclass(orig.qclass),
-  qtype(orig.qtype),
-  d_tcp(orig.d_tcp),
-  d_dnssecOk(orig.d_dnssecOk),
-  d_havetsig(orig.d_havetsig),
-
-  d_tsigsecret(orig.d_tsigsecret),
-  d_tsigkeyname(orig.d_tsigkeyname),
-  d_tsigprevious(orig.d_tsigprevious),
-  d_rrs(orig.d_rrs),
-  d_rawpacket(orig.d_rawpacket),
-  d_eso(orig.d_eso),
-  d_maxreplylen(orig.d_maxreplylen),
-  d_socket(orig.d_socket),
-  d_hash(orig.d_hash),
-  d_ednsrcode(orig.d_ednsrcode),
-  d_ednsversion(orig.d_ednsversion),
-
-  d_wrapped(orig.d_wrapped),
-  d_compress(orig.d_compress),
-  d_tsigtimersonly(orig.d_tsigtimersonly),
-  d_wantsnsid(orig.d_wantsnsid),
-  d_haveednssubnet(orig.d_haveednssubnet),
-  d_haveednssection(orig.d_haveednssection),
-
-  d_isQuery(orig.d_isQuery)
-{
-  DLOG(g_log<<"DNSPacket copy constructor called!"<<endl);
-}
-
 void DNSPacket::setRcode(int v)
 {
   d.rcode=v;
index 4cf8cc4e25e4ab46147b686d217e5736115d2e49..33414511d46d3dff724eeee95e4accf6321eb60c 100644 (file)
@@ -56,7 +56,8 @@ class DNSPacket
 {
 public:
   DNSPacket(bool isQuery);
-  DNSPacket(const DNSPacket &orig);
+  DNSPacket(const DNSPacket &orig) = default;
+  DNSPacket & operator=(const DNSPacket &) = default;
 
   int noparse(const char *mesg, size_t len); //!< just suck the data inward
   int parse(const char *mesg, size_t len); //!< parse a raw UDP or TCP packet and suck the data inward
index c44d674be90c1dd8eb10cb0389de485d52e4033b..4b8a25d2162dffab809b43941126ecb5f1d11fa1 100644 (file)
@@ -447,10 +447,6 @@ DTime::DTime()
   d_set.tv_sec=d_set.tv_usec=0;
 }
 
-DTime::DTime(const DTime &dt) : d_set(dt.d_set)
-{
-}
-
 time_t DTime::time()
 {
   return d_set.tv_sec;
index b6c265ab4601a58276ed0705f152a2e0dc75b1bc..4bd9439a87deab30b7511402d391fe65b36c320c 100644 (file)
@@ -191,7 +191,8 @@ class DTime
 {
 public:
   DTime(); //!< Does not set the timer for you! Saves lots of gettimeofday() calls
-  DTime(const DTime &dt);
+  DTime(const DTime &dt) = default;
+  DTime & operator=(const DTime &dt) = default;
   time_t time();
   inline void set();  //!< Reset the timer
   inline int udiff(); //!< Return the number of microseconds since the timer was last set.
index a496596540a5b694242b6c7c959382e8f5a37acf..ab298b09cd423774242627c3b2f2f25da6a3f0cc 100644 (file)
@@ -10,15 +10,10 @@ struct ResolveContext {
   ResolveContext()
   {
   }
-  ResolveContext(const ResolveContext& ctx)
-  {
-#ifdef HAVE_PROTOBUF
-    this->d_initialRequestId = ctx.d_initialRequestId;
-#endif
-#ifdef HAVE_FSTRM
-    this->d_auth = ctx.d_auth;
-#endif
-  }
+
+  ResolveContext(const ResolveContext& ctx) = delete;
+  ResolveContext & operator=(const ResolveContext&) = delete;
+  
 #ifdef HAVE_PROTOBUF
   boost::optional<const boost::uuids::uuid&> d_initialRequestId;
 #endif
index 02d6483633b13fa16b90bf9c78b699c908124c58..728a067bb43e250fc86076ddbd3b90a779b813a7 100644 (file)
@@ -163,10 +163,9 @@ public:
     d_lastget=d_last;
   }
 
-  DecayingEwma(const DecayingEwma& orig) : d_last(orig.d_last),  d_lastget(orig.d_lastget), d_val(orig.d_val), d_needinit(orig.d_needinit)
-  {
-  }
-
+  DecayingEwma(const DecayingEwma& orig) = delete;
+  DecayingEwma & operator=(const DecayingEwma& orig) = delete;
+  
   void submit(int val, const struct timeval* tv)
   {
     struct timeval now=*tv;