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.
MOADNSParser mdp((char*)&*packet.begin(), (unsigned int)packet.size());
shared_ptr<DNSRecordContent> 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;
}
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);
explicit DNSRecordContent(uint16_t type) : d_qtype(type)
{
- memset(&header,0,sizeof(header));
}
DNSRecordContent& operator=(const DNSRecordContent& orig)
{
const_cast<uint16_t&>(d_qtype) = orig.d_qtype; // **COUGH**
- label = orig.label;
- header = orig.header;
return *this;
}