From: bert hubert Date: Wed, 4 Nov 2015 09:27:21 +0000 (+0100) Subject: now this is a fun commit. Turns out each DNSRecordContent was dragging along a (wrong... X-Git-Tag: dnsdist-1.0.0-alpha1~187^2~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9de51f6ff0ce9b893a1d83af0e7274fe3bcb4be6;p=pdns now this is a fun commit. Turns out each DNSRecordContent was dragging along a (wrong) label field and a whole copy of a dnsheader. sizeof has been reduced by 24 bytes now. Does not actually save a lot of memory because of malloc overhead. Does appear to save CPU. --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index 9ef4cc1c3..bb4b532a3 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -134,9 +134,6 @@ shared_ptr DNSRecordContent::unserialize(const DNSName& qname, MOADNSParser mdp((char*)&*packet.begin(), (unsigned int)packet.size()); shared_ptr ret= mdp.d_answers.begin()->first.d_content; - ret->header.d_type=ret->d_qtype; - ret->label=mdp.d_answers.begin()->first.d_name; - ret->header.d_ttl=mdp.d_answers.begin()->first.d_ttl; return ret; } diff --git a/pdns/dnsparser.hh b/pdns/dnsparser.hh index 4ee358012..0834c3b7a 100644 --- a/pdns/dnsparser.hh +++ b/pdns/dnsparser.hh @@ -192,9 +192,6 @@ public: void doRecordCheck(const struct DNSRecord&){} - DNSName label; // FIXME400 rename - struct dnsrecordheader header; - typedef DNSRecordContent* makerfunc_t(const struct DNSRecord& dr, PacketReader& pr); typedef DNSRecordContent* zmakerfunc_t(const string& str); @@ -239,15 +236,12 @@ public: explicit DNSRecordContent(uint16_t type) : d_qtype(type) { - memset(&header,0,sizeof(header)); } DNSRecordContent& operator=(const DNSRecordContent& orig) { const_cast(d_qtype) = orig.d_qtype; // **COUGH** - label = orig.label; - header = orig.header; return *this; }