Browse Source

[1331] Code cleanups

Michal 'vorner' Vaner 13 years ago
parent
commit
0d94cca23a
2 changed files with 8 additions and 6 deletions
  1. 3 3
      src/lib/datasrc/database.cc
  2. 5 3
      src/lib/datasrc/tests/database_unittest.cc

+ 3 - 3
src/lib/datasrc/database.cc

@@ -955,7 +955,7 @@ DatabaseUpdater::addRRset(const RRset& rrset) {
         diff_phase_ = ADD;
         if (rrset.getType() == RRType::SOA()) {
             serial_ =
-                dynamic_cast<const rdata::generic::SOA&>(it->getCurrent()).
+                dynamic_cast<const generic::SOA&>(it->getCurrent()).
                 getSerial();
         }
     }
@@ -1004,7 +1004,7 @@ DatabaseUpdater::deleteRRset(const RRset& rrset) {
         diff_phase_ = DELETE;
         if (rrset.getType() == RRType::SOA()) {
             serial_ =
-                dynamic_cast<const rdata::generic::SOA&>(it->getCurrent()).
+                dynamic_cast<const generic::SOA&>(it->getCurrent()).
                 getSerial();
         }
     }
@@ -1027,7 +1027,7 @@ DatabaseUpdater::commit() {
                   << db_name_);
     }
     if (journaling_ && diff_phase_ == DELETE) {
-        isc_throw(isc::Unexpected, "Update sequence not complete");
+        isc_throw(isc::BatValue, "Update sequence not complete");
     }
     accessor_->commit();
     committed_ = true; // make sure the destructor won't trigger rollback

+ 5 - 3
src/lib/datasrc/tests/database_unittest.cc

@@ -301,12 +301,14 @@ struct JournalEntry {
     DatabaseAccessor::DiffOperation operation_;
     std::string data_[DatabaseAccessor::DIFF_PARAM_COUNT];
     bool operator==(const JournalEntry& other) const {
-        bool data_equal(true);
         for (size_t i(0); i < DatabaseAccessor::DIFF_PARAM_COUNT; ++ i) {
-            data_equal = data_equal && (data_[i] == other.data_[i]);
+            if (data_[i] != other.data_[i]) {
+                return false;
+            }
         }
+        // No need to check data here, checked above
         return (id_ == other.id_ && serial_ == other.serial_ &&
-                operation_ == other.operation_ && data_equal);
+                operation_ == other.operation_);
     }
 };