From: Mukund Sivaraman Date: Thu, 16 Jan 2014 08:56:49 +0000 (+0530) Subject: [1894] Use a single LabelSequence object instead of doing costly name splits X-Git-Tag: bind10-1.2.0beta1-release~51^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aff22ac34cd7bc2b4e1c9cde1967d995cf2ce4c4;p=thirdparty%2Fkea.git [1894] Use a single LabelSequence object instead of doing costly name splits --- diff --git a/src/lib/datasrc/memory/zone_finder.cc b/src/lib/datasrc/memory/zone_finder.cc index a6c601b957..20ec149ac0 100644 --- a/src/lib/datasrc/memory/zone_finder.cc +++ b/src/lib/datasrc/memory/zone_finder.cc @@ -911,7 +911,7 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) { uint8_t labels_buf[LabelSequence::MAX_SERIALIZED_LENGTH]; const LabelSequence origin_ls(zone_data_.getOriginNode()-> getAbsoluteLabels(labels_buf)); - const LabelSequence name_ls(name); + LabelSequence name_ls(name); if (!zone_data_.isNSEC3Signed()) { isc_throw(DataSourceError, @@ -967,10 +967,9 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) { // Examine all names from the query name to the origin name, stripping // the deepest label one by one, until we find a name that has a matching // NSEC3 hash. - for (unsigned int labels = qlabels; labels >= olabels; --labels) { - const Name& hname = (labels == qlabels ? - name : name.split(qlabels - labels, labels)); - const std::string hlabel = hash->calculate(hname); + for (unsigned int labels = qlabels; labels >= olabels; + --labels, name_ls.stripLeft(1)) { + const std::string hlabel = hash->calculate(name_ls); LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEMORY_FINDNSEC3_TRYHASH). arg(name).arg(labels).arg(hlabel);