]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2378] Simplify the loadIncremental code
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 7 Dec 2012 13:09:05 +0000 (14:09 +0100)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Thu, 13 Dec 2012 10:33:57 +0000 (11:33 +0100)
Some of the code can be shared between the variants, saving some code.

src/lib/datasrc/zone_loader.cc

index 4cb3e0d92b2c98fd9939904da35a2f77ce208a6c..5a36b32032cb5f94ad4a9d77574533b084a38a76 100644 (file)
@@ -110,26 +110,18 @@ ZoneLoader::loadIncremental(size_t limit) {
 
     if (iterator_ == ZoneIteratorPtr()) {
         assert(loader_.get() != NULL);
-        if (loader_->loadIncremental(limit)) {
-            complete_ = true;
-            if (!loaded_ok_) {
-                isc_throw(MasterFileError, "Error while loading master file");
-            } else {
-                updater_->commit();
-            }
-            return (true);
-        } else {
-            return (false);
+        complete_ = loader_->loadIncremental(limit);
+        if (complete_ && !loaded_ok_) {
+            isc_throw(MasterFileError, "Error while loading master file");
         }
     } else {
-        if (copyRRsets(updater_, iterator_, limit)) {
-            updater_->commit();
-            complete_ = true;
-            return (true);
-        } else {
-            return (false);
-        }
+        complete_ = copyRRsets(updater_, iterator_, limit);
+    }
+
+    if (complete_) {
+        updater_->commit();
     }
+    return (complete_);
 }
 
 } // end namespace datasrc