BIND 10 trac1245, updated. b12f4e55007ee2e8130991f322e782bb31a8a289 [1245] update makefile and fix createRRsetObject

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Sep 16 19:52:11 UTC 2011


The branch, trac1245 has been updated
       via  b12f4e55007ee2e8130991f322e782bb31a8a289 (commit)
      from  18083458382473b414a3fc7f57623d2241f487ef (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 b12f4e55007ee2e8130991f322e782bb31a8a289
Author: Jelte Jansen <jelte at isc.org>
Date:   Fri Sep 16 21:51:54 2011 +0200

    [1245] update makefile and fix createRRsetObject

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

Summary of changes:
 src/lib/dns/python/Makefile.am     |   16 +------------
 src/lib/dns/python/rrset_python.cc |   40 ++++++++++++++---------------------
 2 files changed, 18 insertions(+), 38 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/python/Makefile.am b/src/lib/dns/python/Makefile.am
index eb834be..4452e40 100644
--- a/src/lib/dns/python/Makefile.am
+++ b/src/lib/dns/python/Makefile.am
@@ -5,7 +5,7 @@ AM_CPPFLAGS += $(BOOST_INCLUDES)
 AM_CXXFLAGS = $(B10_CXXFLAGS)
 
 lib_LTLIBRARIES = libpydnspp.la
-libpydnspp_la_SOURCES = pydnspp_common.cc pydnspp_towire.h
+libpydnspp_la_SOURCES = pydnspp_common.cc pydnspp_common.h pydnspp_towire.h
 libpydnspp_la_SOURCES += name_python.cc name_python.h
 libpydnspp_la_SOURCES += rrset_python.cc rrset_python.h
 libpydnspp_la_SOURCES += rrclass_python.cc rrclass_python.h
@@ -38,19 +38,7 @@ pydnspp_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_INCLUDES)
 pydnspp_la_CXXFLAGS = $(AM_CXXFLAGS) $(PYTHON_CXXFLAGS)
 pydnspp_la_LDFLAGS = $(PYTHON_LDFLAGS)
 
-# directly included from source files, so these don't have their own
-# rules
-EXTRA_DIST = pydnspp_common.h
-EXTRA_DIST += edns_python.cc
-EXTRA_DIST += message_python.cc
-EXTRA_DIST += rrclass_python.cc
-EXTRA_DIST += opcode_python.cc
-EXTRA_DIST += rrset_python.cc
-EXTRA_DIST += question_python.cc
-EXTRA_DIST += rrttl_python.cc
-EXTRA_DIST += rdata_python.cc
-EXTRA_DIST += rrtype_python.cc
-EXTRA_DIST += tsigerror_python_inc.cc
+EXTRA_DIST = tsigerror_python_inc.cc
 
 # Python prefers .so, while some OSes (specifically MacOS) use a different
 # suffix for dynamic objects.  -module is necessary to work this around.
diff --git a/src/lib/dns/python/rrset_python.cc b/src/lib/dns/python/rrset_python.cc
index 2c33920..a4e9d30 100644
--- a/src/lib/dns/python/rrset_python.cc
+++ b/src/lib/dns/python/rrset_python.cc
@@ -48,10 +48,6 @@ public:
     isc::dns::RRsetPtr cppobj;
 };
 
-
-// Shortcut type which would be convenient for adding class variables safely.
-typedef CPPPyObjectContainer<s_RRset, RRset> RRsetContainer;
-
 int RRset_init(s_RRset* self, PyObject* args);
 void RRset_destroy(s_RRset* self);
 
@@ -381,34 +377,30 @@ initModulePart_RRset(PyObject* mod) {
 
 PyObject*
 createRRsetObject(const RRset& source) {
-    s_RRset* py_rrset =
-        static_cast<s_RRset*>(rrset_type.tp_alloc(&rrset_type, 0));
-    if (py_rrset == NULL) {
-        isc_throw(PyCPPWrapperException, "Unexpected NULL C++ object, "
-                  "probably due to short memory");
-    }
 
     // RRsets are noncopyable, so as a workaround we recreate a new one
     // and copy over all content
-    try {
-        py_rrset->cppobj = isc::dns::RRsetPtr(
-            new isc::dns::RRset(source.getName(), source.getClass(),
-                                source.getType(), source.getTTL()));
+    RRsetPtr new_rrset = isc::dns::RRsetPtr(
+        new isc::dns::RRset(source.getName(), source.getClass(),
+                            source.getType(), source.getTTL()));
 
-        isc::dns::RdataIteratorPtr rdata_it(source.getRdataIterator());
-        for (rdata_it->first(); !rdata_it->isLast(); rdata_it->next()) {
-            py_rrset->cppobj->addRdata(rdata_it->getCurrent());
-        }
+    isc::dns::RdataIteratorPtr rdata_it(source.getRdataIterator());
+    for (rdata_it->first(); !rdata_it->isLast(); rdata_it->next()) {
+        new_rrset->addRdata(rdata_it->getCurrent());
+    }
 
-        isc::dns::RRsetPtr sigs = source.getRRsig();
-        if (sigs) {
-            py_rrset->cppobj->addRRsig(sigs);
-        }
-        return (py_rrset);
-    } catch (const std::bad_alloc&) {
+    isc::dns::RRsetPtr sigs = source.getRRsig();
+    if (sigs) {
+        new_rrset->addRRsig(sigs);
+    }
+    s_RRset* py_rrset =
+        static_cast<s_RRset*>(rrset_type.tp_alloc(&rrset_type, 0));
+    if (py_rrset == NULL) {
         isc_throw(PyCPPWrapperException, "Unexpected NULL C++ object, "
                   "probably due to short memory");
     }
+    py_rrset->cppobj = new_rrset;
+    return (py_rrset);
 }
 
 bool




More information about the bind10-changes mailing list