From 1b7c449b300c102e9d62055d019244ec4ddb627e Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 14 Mar 2018 18:27:33 +0100 Subject: [PATCH] dnsdist: Don't copy labels into a deque when inserting in StatNode --- pdns/statnode.cc | 21 ++++++++------------- pdns/statnode.hh | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/pdns/statnode.cc b/pdns/statnode.cc index 358e22036..7e8578d8b 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); }; -- 2.40.0