BIND 10 trac1894, updated. 7c1e2ec6c98e82f0f14fbe479cb2e4f68117f8d0 [1894] Minor coding style fix

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Feb 4 04:19:48 UTC 2014


The branch, trac1894 has been updated
       via  7c1e2ec6c98e82f0f14fbe479cb2e4f68117f8d0 (commit)
       via  f2ce3de4f881befc57c6328ceffb549a1a0c76af (commit)
      from  498b511dccc63bc88c0fad6a9ef0821ba8ad1cf6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7c1e2ec6c98e82f0f14fbe479cb2e4f68117f8d0
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Feb 4 09:49:12 2014 +0530

    [1894] Minor coding style fix

commit f2ce3de4f881befc57c6328ceffb549a1a0c76af
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Feb 4 09:49:00 2014 +0530

    [1894] Avoid doing costly name splits (database backend)

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/database.cc           |   11 +++++++----
 src/lib/datasrc/memory/zone_finder.cc |    3 ++-
 2 files changed, 9 insertions(+), 5 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index 9c85054..d8f8ae0 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -23,6 +23,7 @@
 
 #include <exceptions/exceptions.h>
 #include <dns/name.h>
+#include <dns/labelsequence.h>
 #include <dns/rrclass.h>
 #include <dns/rrttl.h>
 #include <dns/rrset.h>
@@ -1108,12 +1109,14 @@ DatabaseClient::Finder::findNSEC3(const Name& name, bool recursive) {
     // This will be set to the one covering the query name
     ConstRRsetPtr covering_proof;
 
+    LabelSequence name_ls(name);
     // We keep stripping the leftmost label until we find something.
     // In case it is recursive, we'll exit the loop at the first iteration.
-    for (unsigned labels(qlabels); labels >= olabels; -- labels) {
-        const string hash(calculator->calculate(labels == qlabels ? name :
-                                                name.split(qlabels - labels,
-                                                           labels)));
+    for (unsigned int labels = qlabels; labels >= olabels;
+         --labels, name_ls.stripLeft(1))
+    {
+        const std::string hash = calculator->calculate(name_ls);
+
         // Get the exact match for the name.
         LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_DATABASE_FINDNSEC3_TRYHASH).
             arg(name).arg(labels).arg(hash);
diff --git a/src/lib/datasrc/memory/zone_finder.cc b/src/lib/datasrc/memory/zone_finder.cc
index 20ec149..d121de6 100644
--- a/src/lib/datasrc/memory/zone_finder.cc
+++ b/src/lib/datasrc/memory/zone_finder.cc
@@ -968,7 +968,8 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) {
     // 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, name_ls.stripLeft(1)) {
+         --labels, name_ls.stripLeft(1))
+    {
         const std::string hlabel = hash->calculate(name_ls);
 
         LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEMORY_FINDNSEC3_TRYHASH).



More information about the bind10-changes mailing list