BIND 10 trac2387, updated. 29ec8dce0f9312be9cddb3712fbd107fb62e33d3 [2387] Unify code from MX constructors

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Mar 28 02:56:37 UTC 2013


The branch, trac2387 has been updated
       via  29ec8dce0f9312be9cddb3712fbd107fb62e33d3 (commit)
      from  c70bba06b9157645d6493b16ef0ee414277ce7b1 (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 29ec8dce0f9312be9cddb3712fbd107fb62e33d3
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Mar 28 08:18:35 2013 +0530

    [2387] Unify code from MX constructors
    
    This is an offshoot from #2391. There's no need to create yet another
    ticket for it.

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

Summary of changes:
 src/lib/dns/rdata/generic/mx_15.cc |   17 +++++++----------
 src/lib/dns/rdata/generic/mx_15.h  |    3 +++
 2 files changed, 10 insertions(+), 10 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/rdata/generic/mx_15.cc b/src/lib/dns/rdata/generic/mx_15.cc
index 12ada97..ae9978e 100644
--- a/src/lib/dns/rdata/generic/mx_15.cc
+++ b/src/lib/dns/rdata/generic/mx_15.cc
@@ -68,15 +68,7 @@ MX::MX(const std::string& mx_str) :
         MasterLexer lexer;
         lexer.pushSource(ss);
 
-        const uint32_t num =
-            lexer.getNextToken(MasterToken::NUMBER).getNumber();
-        if (num > 65535) {
-            isc_throw(InvalidRdataText, "Invalid MX preference in: "
-                      << mx_str);
-        }
-        preference_ = static_cast<uint16_t>(num);
-
-        mxname_ = createNameFromLexer(lexer, NULL);
+        constructFromLexer(lexer, NULL);
 
         if (lexer.getNextToken().getType() != MasterToken::END_OF_FILE) {
             isc_throw(InvalidRdataText, "extra input text for MX: "
@@ -108,8 +100,13 @@ MX::MX(const std::string& mx_str) :
 /// is non-absolute.
 MX::MX(MasterLexer& lexer, const Name* origin,
        MasterLoader::Options, MasterLoaderCallbacks&) :
-    preference_(0), mxname_(".")
+    preference_(0), mxname_(Name::ROOT_NAME())
 {
+    constructFromLexer(lexer, origin);
+}
+
+void
+MX::constructFromLexer(MasterLexer& lexer, const Name* origin) {
     const uint32_t num = lexer.getNextToken(MasterToken::NUMBER).getNumber();
     if (num > 65535) {
         isc_throw(InvalidRdataText, "Invalid MX preference: " << num);
diff --git a/src/lib/dns/rdata/generic/mx_15.h b/src/lib/dns/rdata/generic/mx_15.h
index 1381f18..84e7112 100644
--- a/src/lib/dns/rdata/generic/mx_15.h
+++ b/src/lib/dns/rdata/generic/mx_15.h
@@ -42,6 +42,9 @@ public:
     uint16_t getMXPref() const;
 
 private:
+    void constructFromLexer(isc::dns::MasterLexer& lexer,
+                            const isc::dns::Name* origin);
+
     /// Note: this is a prototype version; we may reconsider
     /// this representation later.
     uint16_t preference_;



More information about the bind10-changes mailing list