BIND 10 trac1183, updated. 954143a2748110c720d28df49159ed4f0bc1a1a2 [1183] trivial/minor suggested cleanups: they are mainly indentation, constify, typo, removing redundant space, etc.

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Aug 18 22:50:25 UTC 2011


The branch, trac1183 has been updated
       via  954143a2748110c720d28df49159ed4f0bc1a1a2 (commit)
      from  8cfa0f76baf92f82bf2865b3557c0a2094e81cb4 (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 954143a2748110c720d28df49159ed4f0bc1a1a2
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Aug 18 15:49:38 2011 -0700

    [1183] trivial/minor suggested cleanups: they are mainly indentation,
    constify, typo, removing redundant space, etc.

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

Summary of changes:
 src/lib/datasrc/database.cc                |   26 ++++++++++++--------------
 src/lib/datasrc/database.h                 |   10 +++++-----
 src/lib/datasrc/sqlite3_accessor.cc        |    4 ++--
 src/lib/datasrc/tests/database_unittest.cc |    2 +-
 4 files changed, 20 insertions(+), 22 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index 043567a..c6f4c11 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -185,7 +185,7 @@ DatabaseClient::Finder::getRRset(const isc::dns::Name& name,
     DatabaseAccessor::IteratorContextPtr
         context(database_->getRecords(name, zone_id_));
     // It must not return NULL, that's a bug of the implementation
-    if (context == DatabaseAccessor::IteratorContextPtr()) {
+    if (!context) {
         isc_throw(isc::Unexpected, "Iterator context null at " +
                   name.toText());
     }
@@ -292,7 +292,6 @@ DatabaseClient::Finder::getRRset(const isc::dns::Name& name,
     return (std::pair<bool, isc::dns::RRsetPtr>(records_found, result_rrset));
 }
 
-
 ZoneFinder::FindResult
 DatabaseClient::Finder::find(const isc::dns::Name& name,
                              const isc::dns::RRType& type,
@@ -310,30 +309,30 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
         .arg(database_->getDBName()).arg(name).arg(type);
 
     // First, do we have any kind of delegation (NS/DNAME) here?
-    Name origin(getOrigin());
-    size_t origin_label_count(origin.getLabelCount());
-    size_t current_label_count(name.getLabelCount());
+    const Name origin(getOrigin());
+    const size_t origin_label_count(origin.getLabelCount());
+    const size_t current_label_count(name.getLabelCount());
     // This is how many labels we remove to get origin
-    size_t remove_labels(current_label_count - origin_label_count);
+    const size_t remove_labels(current_label_count - origin_label_count);
 
     // Now go trough all superdomains from origin down
     for (int i(remove_labels); i > 0; --i) {
-        Name superdomain(name.split(i));
+        const Name superdomain(name.split(i));
         // Look if there's NS or DNAME (but ignore the NS in origin)
         found = getRRset(superdomain, NULL, false, true,
-                            i != remove_labels && !glue_ok);
+                         i != remove_labels && !glue_ok);
         if (found.second) {
             // We found something redirecting somewhere else
             // (it can be only NS or DNAME here)
             result_rrset = found.second;
             if (result_rrset->getType() == isc::dns::RRType::NS()) {
                 LOG_DEBUG(logger, DBG_TRACE_DETAILED,
-                            DATASRC_DATABASE_FOUND_DELEGATION).
+                          DATASRC_DATABASE_FOUND_DELEGATION).
                     arg(database_->getDBName()).arg(superdomain);
                 result_status = DELEGATION;
             } else {
                 LOG_DEBUG(logger, DBG_TRACE_DETAILED,
-                            DATASRC_DATABASE_FOUND_DNAME).
+                          DATASRC_DATABASE_FOUND_DNAME).
                     arg(database_->getDBName()).arg(superdomain);
                 result_status = DNAME;
             }
@@ -346,18 +345,17 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
         // Try getting the final result and extract it
         // It is special if there's a CNAME or NS, DNAME is ignored here
         // And we don't consider the NS in origin
-        found = getRRset(name, &type, true, false,
-                            name != origin && !glue_ok);
+        found = getRRset(name, &type, true, false, name != origin && !glue_ok);
         records_found = found.first;
         result_rrset = found.second;
         if (result_rrset && name != origin && !glue_ok &&
             result_rrset->getType() == isc::dns::RRType::NS()) {
             LOG_DEBUG(logger, DBG_TRACE_DETAILED,
-                        DATASRC_DATABASE_FOUND_DELEGATION_EXACT).
+                      DATASRC_DATABASE_FOUND_DELEGATION_EXACT).
                 arg(database_->getDBName()).arg(name);
             result_status = DELEGATION;
         } else if (result_rrset && type != isc::dns::RRType::CNAME() &&
-                    result_rrset->getType() == isc::dns::RRType::CNAME()) {
+                   result_rrset->getType() == isc::dns::RRType::CNAME()) {
             result_status = CNAME;
         }
     }
diff --git a/src/lib/datasrc/database.h b/src/lib/datasrc/database.h
index cf6ac94..6856859 100644
--- a/src/lib/datasrc/database.h
+++ b/src/lib/datasrc/database.h
@@ -111,11 +111,11 @@ public:
          * Depending on how the iterator was constructed, there is a difference
          * in behaviour; for a 'full zone iterator', created with
          * getAllRecords(), all 5 elements of the array are overwritten.
-         * for a 'name iterator', created with getRecords(), the fifth column
+         * For a 'name iterator', created with getRecords(), the fifth column
          * (NAME_COLUMN) is untouched, since what would be added here is by
          * definition already known to the caller (it already passes it as
          * an argument to getRecords()).
-         * 
+         *
          * \note The order of RRs is not strictly set, but the RRs for single
          * RRset must not be interleaved with any other RRs (eg. RRsets must be
          * "together").
@@ -138,7 +138,7 @@ public:
      * \brief Creates an iterator context for a specific name.
      *
      * This should create a new iterator context to be used by
-     * DatabaseConnection's ZoneIterator. It can be created based on the name
+     * DatabaseAccessor's ZoneIterator. It can be created based on the name
      * or the ID (returned from getZone()), what is more comfortable for the
      * database implementation. Both are provided (and are guaranteed to match,
      * the DatabaseClient first looks up the zone ID and then calls this).
@@ -174,7 +174,7 @@ public:
      * \brief Creates an iterator context for the whole zone.
      *
      * This should create a new iterator context to be used by
-     * DatabaseConnection's ZoneIterator. It can be created based on the name
+     * DatabaseAccessor's ZoneIterator. It can be created based on the name
      * or the ID (returned from getZone()), what is more comfortable for the
      * database implementation. Both are provided (and are guaranteed to match,
      * the DatabaseClient first looks up the zone ID and then calls this).
@@ -201,7 +201,7 @@ public:
 
     /**
      * Definitions of the fields as they are required to be filled in
-     * by getNextRecord()
+     * by IteratorContext::getNext()
      *
      * When implementing getNext(), the columns array should
      * be filled with the values as described in this enumeration,
diff --git a/src/lib/datasrc/sqlite3_accessor.cc b/src/lib/datasrc/sqlite3_accessor.cc
index dbef967..070c6c5 100644
--- a/src/lib/datasrc/sqlite3_accessor.cc
+++ b/src/lib/datasrc/sqlite3_accessor.cc
@@ -395,7 +395,7 @@ public:
 
     bool getNext(std::string (&data)[COLUMN_COUNT]) {
         // If there's another row, get it
-        int rc(sqlite3_step(statement_));
+        const int rc(sqlite3_step(statement_));
         if (rc == SQLITE_ROW) {
             // For both types, we copy the first four columns
             copyColumn(data, TYPE_COLUMN);
@@ -452,7 +452,7 @@ private:
         }
     }
 
-    IteratorType iterator_type_;
+    const IteratorType iterator_type_;
     boost::shared_ptr<const SQLite3Database> database_;
     sqlite3_stmt *statement_;
 };
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index e8998a5..f3311a8 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -245,7 +245,7 @@ public:
 
 private:
     std::map<std::string, std::vector< std::vector<std::string> > > records;
-    // used as temporary storageduring the building of the fake data
+    // used as temporary storage during the building of the fake data
     std::vector< std::vector<std::string> > cur_name;
 
     // Adds one record to the current name in the database




More information about the bind10-changes mailing list