From: Remi Gacogne Date: Wed, 14 Mar 2018 17:27:33 +0000 (+0100) Subject: dnsdist: Don't copy labels into a deque when inserting in StatNode X-Git-Tag: dnsdist-1.3.0~49^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b7c449b300c102e9d62055d019244ec4ddb627e;p=thirdparty%2Fpdns.git dnsdist: Don't copy labels into a deque when inserting in StatNode --- diff --git a/pdns/statnode.cc b/pdns/statnode.cc index 358e220368..7e8578d8b1 100644 --- a/pdns/statnode.cc +++ b/pdns/statnode.cc @@ -57,15 +57,12 @@ void StatNode::visit(visitor_t visitor, Stat &newstat, unsigned int depth) cons void StatNode::submit(const DNSName& domain, int rcode, const ComboAddress& remote) { // cerr<<"FIRST submit called on '"< tmp = domain.getRawLabels(); + std::vector tmp = domain.getRawLabels(); if(tmp.empty()) return; - deque parts; - for(auto const i : tmp) { - parts.push_back(i); - } - children[parts.back()].submit(parts, "", rcode, remote, 1); + auto last = tmp.end() - 1; + children[*last].submit(last, tmp.begin(), "", rcode, remote, 1); } /* www.powerdns.com. -> @@ -75,24 +72,22 @@ void StatNode::submit(const DNSName& domain, int rcode, const ComboAddress& remo www.powerdns.com. */ -void StatNode::submit(deque& labels, const std::string& domain, int rcode, const ComboAddress& remote, unsigned int count) +void StatNode::submit(std::vector::const_iterator end, std::vector::const_iterator begin, const std::string& domain, int rcode, const ComboAddress& remote, unsigned int count) { - if(labels.empty()) - return; // cerr<<"Submit called for domain='"<& labels, const std::string& domain, int rcod labelsCount = count; } // cerr<<"Not yet end, set our fullname to '"<& labels, const std::string& domain, int rcode, const ComboAddress& remote, unsigned int count); + void submit(std::vector::const_iterator end, std::vector::const_iterator begin, const std::string& domain, int rcode, const ComboAddress& remote, unsigned int count); };