BIND 10 trac3112, updated. ab67242d4cf7ae3bbdb7d0a57f55b44350cfc2fc [3112] Assign the TTL objects using a helper function

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Sep 18 12:03:48 UTC 2013


The branch, trac3112 has been updated
       via  ab67242d4cf7ae3bbdb7d0a57f55b44350cfc2fc (commit)
      from  dd4f121644d51c4bf1b943dda702bd72482eb090 (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 ab67242d4cf7ae3bbdb7d0a57f55b44350cfc2fc
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Sep 18 17:33:03 2013 +0530

    [3112] Assign the TTL objects using a helper function

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

Summary of changes:
 src/lib/dns/master_loader.cc |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc
index 6a34c25..6b6e091 100644
--- a/src/lib/dns/master_loader.cc
+++ b/src/lib/dns/master_loader.cc
@@ -275,11 +275,7 @@ private:
     // care about where it comes from).  see LimitTTL() for parameter
     // post_parsing.
     void setDefaultTTL(const RRTTL& ttl, bool post_parsing) {
-        if (!default_ttl_) {
-            default_ttl_.reset(new RRTTL(ttl));
-        } else {
-            *default_ttl_ = ttl;
-        }
+        assignTTL(default_ttl_, ttl);
         limitTTL(*default_ttl_, post_parsing);
     }
 
@@ -324,11 +320,7 @@ private:
                     dynamic_cast<const rdata::generic::SOA&>(*rdata).
                     getMinimum();
                 setDefaultTTL(RRTTL(ttl_val), true);
-                if (!current_ttl_) {
-                    current_ttl_.reset(new RRTTL(*default_ttl_));
-                } else {
-                    *current_ttl_ = *default_ttl_;
-                }
+                assignTTL(current_ttl_, *default_ttl_);
             } else {
                 // On catching the exception we'll try to reach EOL again,
                 // so we need to unget it now.
@@ -337,11 +329,7 @@ private:
                                         "no TTL specified; load rejected");
             }
         } else if (!explicit_ttl && default_ttl_) {
-            if (!current_ttl_) {
-                current_ttl_.reset(new RRTTL(*default_ttl_));
-            } else {
-                *current_ttl_ = *default_ttl_;
-            }
+            assignTTL(current_ttl_, *default_ttl_);
         } else if (!explicit_ttl && warn_rfc1035_ttl_) {
             // Omitted (class and) TTL values are default to the last
             // explicitly stated values (RFC 1035, Sec. 5.1).
@@ -398,6 +386,17 @@ private:
         }
     }
 
+    /// \brief Assign the right RRTTL's value to the left RRTTL. If one
+    /// doesn't exist in the scoped_ptr, make a new RRTTL copy of the
+    /// right argument.
+    static void assignTTL(boost::scoped_ptr<RRTTL>& left, const RRTTL& right) {
+        if (!left) {
+            left.reset(new RRTTL(right));
+        } else {
+            *left = right;
+        }
+    }
+
 private:
     MasterLexer lexer_;
     const Name zone_origin_;



More information about the bind10-changes mailing list