BIND 10 trac2432, updated. ee424bbc727b754b8030fb2adaa69c578f096de9 [2432] Move common code into a helper method

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jan 3 11:27:49 UTC 2013


The branch, trac2432 has been updated
       via  ee424bbc727b754b8030fb2adaa69c578f096de9 (commit)
      from  bdf19add5fca40dbc91c6ce4c0d87d8bb6080bde (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 ee424bbc727b754b8030fb2adaa69c578f096de9
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Jan 3 16:57:08 2013 +0530

    [2432] Move common code into a helper method

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

Summary of changes:
 src/lib/dns/rrset_collection.cc |   23 ++++++++++++-----------
 src/lib/dns/rrset_collection.h  |    3 +++
 2 files changed, 15 insertions(+), 11 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/rrset_collection.cc b/src/lib/dns/rrset_collection.cc
index 8ee85be..a16e529 100644
--- a/src/lib/dns/rrset_collection.cc
+++ b/src/lib/dns/rrset_collection.cc
@@ -55,30 +55,31 @@ RRsetCollection::addRRset(RRsetPtr rrset) {
     rrsets_.insert(std::pair<CollectionKey, RRsetPtr>(key, rrset));
 }
 
-RRsetCollection::RRsetCollection(const char* filename, const Name& origin,
-                                 const RRClass& rrclass)
+template<typename T>
+void
+RRsetCollection::constructHelper(T source, const isc::dns::Name& origin,
+                                 const isc::dns::RRClass& rrclass)
 {
     MasterLoaderCallbacks callbacks
         (boost::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3),
          boost::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3));
-    MasterLoader loader(filename, origin, rrclass, callbacks,
+    MasterLoader loader(source, origin, rrclass, callbacks,
                         boost::bind(&RRsetCollection::addRRset,
                                     this, _1, _2, _3, _4, _5),
                         MasterLoader::DEFAULT);
     loader.load();
 }
 
+RRsetCollection::RRsetCollection(const char* filename, const Name& origin,
+                                 const RRClass& rrclass)
+{
+    constructHelper<const char*>(filename, origin, rrclass);
+}
+
 RRsetCollection::RRsetCollection(std::istream& input_stream, const Name& origin,
                                  const RRClass& rrclass)
 {
-    MasterLoaderCallbacks callbacks
-        (boost::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3),
-         boost::bind(&RRsetCollection::loaderCallback, this, _1, _2, _3));
-    MasterLoader loader(input_stream, origin, rrclass, callbacks,
-                        boost::bind(&RRsetCollection::addRRset,
-                                    this, _1, _2, _3, _4, _5),
-                        MasterLoader::DEFAULT);
-    loader.load();
+    constructHelper<std::istream&>(input_stream, origin, rrclass);
 }
 
 const AbstractRRset*
diff --git a/src/lib/dns/rrset_collection.h b/src/lib/dns/rrset_collection.h
index b44faab..1456f9f 100644
--- a/src/lib/dns/rrset_collection.h
+++ b/src/lib/dns/rrset_collection.h
@@ -118,6 +118,9 @@ public:
                                  const isc::dns::RRType& rrtype) const;
 
 private:
+    template<typename T>
+    void constructHelper(T source, const isc::dns::Name& origin,
+                         const isc::dns::RRClass& rrclass);
     void addRRset(const isc::dns::Name& name, const isc::dns::RRClass& rrclass,
                   const isc::dns::RRType& rrtype, const isc::dns::RRTTL& rrttl,
                   const isc::dns::rdata::RdataPtr& data);



More information about the bind10-changes mailing list