BIND 10 trac2428, updated. de08d209347b6639bc28d1847344c80616a6cb87 [2428] Implement popping of sources

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Dec 10 18:25:03 UTC 2012


The branch, trac2428 has been updated
       via  de08d209347b6639bc28d1847344c80616a6cb87 (commit)
      from  1b7273a397602ebd1d04d692f517941624d89839 (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 de08d209347b6639bc28d1847344c80616a6cb87
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Dec 10 19:24:34 2012 +0100

    [2428] Implement popping of sources
    
    At least in the normal case. Error cases must still be handled.

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

Summary of changes:
 src/lib/dns/master_loader.cc |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc
index 4457e38..a68c67f 100644
--- a/src/lib/dns/master_loader.cc
+++ b/src/lib/dns/master_loader.cc
@@ -58,6 +58,7 @@ public:
         initialized_(false),
         ok_(true),
         many_errors_((options & MANY_ERRORS) != 0),
+        source_count_(0),
         complete_(false),
         seen_error_(false)
     {}
@@ -90,11 +91,18 @@ public:
             }
         }
         initialized_ = true;
+        ++source_count_;
+    }
+
+    bool popSource() {
+        lexer_.popSource();
+        return (--source_count_ != 0);
     }
 
     void pushStreamSource(std::istream& stream) {
         lexer_.pushSource(stream);
         initialized_ = true;
+        ++source_count_;
     }
 
     // Get a string token. Handle it as error if it is not string.
@@ -159,6 +167,7 @@ private:
     bool ok_;                   // Is it OK to continue loading?
     const bool many_errors_;    // Are many errors allowed (or should we abort
                                 // on the first)
+    size_t source_count_;       // How many sources are currently pushed.
 public:
     bool complete_;             // All work done.
     bool seen_error_;           // Was there at least one error during the
@@ -185,8 +194,13 @@ MasterLoader::MasterLoaderImpl::loadIncremental(size_t count_limit) {
             do {
                 const MasterToken& empty_token(lexer_.getNextToken());
                 if (empty_token.getType() == MasterToken::END_OF_FILE) {
-                    // TODO: Check if this is the last source, possibly pop
-                    return (true);
+                    if (!popSource()) {
+                        return (true);
+                    } else {
+                        // We try to read a token from the popped source
+                        // So retry the loop
+                        continue;
+                    }
                 }
                 empty = empty_token.getType() == MasterToken::END_OF_LINE;
             } while (empty);



More information about the bind10-changes mailing list