]> granicus.if.org Git - pdns/commitdiff
rec: perform constructor initialization in initialization list
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Tue, 27 Mar 2018 22:14:13 +0000 (00:14 +0200)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Fri, 30 Mar 2018 11:12:51 +0000 (13:12 +0200)
pdns/dnsparser.hh
pdns/dnsrecords.cc
pdns/gss_context.cc
pdns/logger.cc
pdns/logger.hh

index 9ddc942ab568e28357900003d16423dd468be675..28ce70386bb2f9f7855e7d2eda47cb1940adab1f 100644 (file)
@@ -276,13 +276,8 @@ protected:
 
 struct DNSRecord
 {
-  DNSRecord() {
-    d_type = 0;
-    d_class = QClass::IN;
-    d_ttl = 0;
-    d_clen = 0;
-    d_place = DNSResourceRecord::ANSWER;
-  }
+  DNSRecord() : d_type(0), d_class(QClass::IN), d_ttl(0), d_clen(0), d_place(DNSResourceRecord::ANSWER)
+  {}
   explicit DNSRecord(const DNSResourceRecord& rr);
   DNSName d_name;
   std::shared_ptr<DNSRecordContent> d_content;
index 6ee780f21a38fea2c2de3fc4ccb73c0eecd4ff66..6f88eee25624454484dafb4c035bc8316ffc04c7 100644 (file)
@@ -266,9 +266,8 @@ boilerplate_conv(SRV, QType::SRV,
                  )
 
 SOARecordContent::SOARecordContent(const DNSName& mname, const DNSName& rname, const struct soatimes& st) 
-: d_mname(mname), d_rname(rname)
+: d_mname(mname), d_rname(rname), d_st(st)
 {
-  d_st=st;
 }
 
 boilerplate_conv(SOA, QType::SOA,
index 8ef1061cce70e6ed7c95c52cf854585da393c8c8..3c2ed292cd2e8c23efc7f9ab4bdfefeb7b1a3063 100644 (file)
@@ -40,8 +40,8 @@
 #ifndef ENABLE_GSS_TSIG
 
 bool GssContext::supported() { return false; }
-GssContext::GssContext() { d_error = GSS_CONTEXT_UNSUPPORTED; d_type = GSS_CONTEXT_NONE; }
-GssContext::GssContext(const DNSName& label) { d_error = GSS_CONTEXT_UNSUPPORTED; d_type = GSS_CONTEXT_NONE; }
+GssContext::GssContext() : d_error(GSS_CONTEXT_UNSUPPORTED), d_type(GSS_CONTEXT_NONE) {}
+GssContext::GssContext(const DNSName& label) : d_error(GSS_CONTEXT_UNSUPPORTED), d_type(GSS_CONTEXT_NONE) {}
 void GssContext::setLocalPrincipal(const std::string& name) {}
 bool GssContext::getLocalPrincipal(std::string& name) { return false; }
 void GssContext::setPeerPrincipal(const std::string& name) {}
@@ -61,14 +61,9 @@ GssContextError GssContext::getError() { return GSS_CONTEXT_UNSUPPORTED; }
 
 class GssCredential : boost::noncopyable {
 public:
-  GssCredential(const std::string& name, const gss_cred_usage_t usage) {
+  GssCredential(const std::string& name, const gss_cred_usage_t usage) :
+    d_valid(false), d_nameS(name), d_name(GSS_C_NO_NAME), d_cred(GSS_C_NO_CREDENTIAL), d_usage(usage) {
     gss_buffer_desc buffer;
-    d_name = GSS_C_NO_NAME;
-    d_nameS = name;
-    d_cred = GSS_C_NO_CREDENTIAL;
-
-    d_usage = usage;
-    d_valid = false;
     
     if (name.empty() == false) {
       buffer.length = name.size();
index 484768ffe73889f0945427fef34ee60a103f3be6..0e3c54c8b0776fbe4fe8fb77ed2c20c7791a522d 100644 (file)
@@ -102,16 +102,10 @@ void Logger::initKey()
     unixDie("Creating thread key for logger");
 }
 
-Logger::Logger(const string &n, int facility)
+Logger::Logger(const string &n, int facility) :
+  name(n), flags(LOG_PID|LOG_NDELAY), d_facility(facility), d_loglevel(Logger::None),
+  consoleUrgency(Error), opened(false), d_disableSyslog(false)
 {
-  opened=false;
-  flags=LOG_PID|LOG_NDELAY;
-  d_facility=facility;
-  d_loglevel=Logger::None;
-  d_disableSyslog=false;
-  consoleUrgency=Error;
-  name=n;
-
   if(pthread_once(&s_once, initKey))
     unixDie("Creating thread key for logger");
 
index 5cd9e18e8eb5d0ae28e71f024f2baa6a2560a760..e08fa0d548140138eb30ba1058da906d6bb094e9 100644 (file)
@@ -92,10 +92,8 @@ public:
 private:
   struct PerThread
   {
-    PerThread() 
-    {
-      d_urgency=Info;
-    }
+    PerThread() : d_urgency(Info)
+    {}
     string d_output;
     Urgency d_urgency;
   };