From 1ca162f5f6fc5a762d32d9d14eaf4f8bc4fd145b Mon Sep 17 00:00:00 2001 From: bert hubert Date: Wed, 4 Nov 2015 10:27:21 +0100 Subject: [PATCH] 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. --- pdns/dnsparser.cc | 3 --- pdns/dnsparser.hh | 6 ------ 2 files changed, 9 deletions(-) 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; } -- 2.40.0