Browse Source

parenthesized return statements
also removed the now unnecessary static_casts


git-svn-id: svn://bind10.isc.org/svn/bind10/experiments/python-binding@2265 e5f2f494-b856-4b98-b285-d166d9295462

Jelte Jansen 15 years ago
parent
commit
f58095d1e8

+ 11 - 11
src/lib/dns/python/libdns_python.cc

@@ -76,7 +76,7 @@ PyMODINIT_FUNC
 PyInit_libdns_python(void) {
     PyObject *mod = PyModule_Create(&libdns_python);
     if (mod == NULL) {
-        return NULL;
+        return (NULL);
     }
 
     po_IscException = PyErr_NewException("libdns_python.IscException", NULL, NULL);
@@ -85,41 +85,41 @@ PyInit_libdns_python(void) {
     // for each part included above, we call its specific initializer
 
     if (!initModulePart_Name(mod)) {
-        return NULL;
+        return (NULL);
     }
 
     if (!initModulePart_MessageRenderer(mod)) {
-        return NULL;
+        return (NULL);
     }
 
     if (!initModulePart_RRClass(mod)) {
-        return NULL;
+        return (NULL);
     }
 
     if (!initModulePart_RRType(mod)) {
-        return NULL;
+        return (NULL);
     }
 
     if (!initModulePart_RRTTL(mod)) {
-        return NULL;
+        return (NULL);
     }
 
     if (!initModulePart_Rdata(mod)) {
-        return NULL;
+        return (NULL);
     }
 
     if (!initModulePart_RRset(mod)) {
-        return NULL;
+        return (NULL);
     }
 
     if (!initModulePart_Question(mod)) {
-        return NULL;
+        return (NULL);
     }
 
     if (!initModulePart_Message(mod)) {
-        return NULL;
+        return (NULL);
     }
 
-    return mod;
+    return (mod);
 }
 

+ 4 - 4
src/lib/dns/python/libdns_python_common.cc

@@ -25,24 +25,24 @@ readDataFromSequence(uint8_t *data, size_t len, PyObject* sequence) {
         if (!el) {
             PyErr_SetString(PyExc_TypeError,
                 "sequence too short");
-            return -1;
+            return (-1);
         }
         if (PyLong_Check(el)) {
             long l = PyLong_AsLong(el);
             if (l < 0 || l > 255) {
                 PyErr_SetString(PyExc_TypeError,
                     "number in fromWire sequence not between 0 and 255");
-                return -1;
+                return (-1);
             }
             data[i] = static_cast<uint8_t>(PyLong_AsLong(el));
         } else {
             PyErr_SetString(PyExc_TypeError,
                 "not a number in fromWire sequence");
-            return -1;
+            return (-1);
         }
     }
     PySequence_DelSlice(sequence, 0, len);
-    return 0;
+    return (0);
 }
 
 

+ 130 - 152
src/lib/dns/python/message_python.cc

@@ -127,7 +127,7 @@ MessageFlag_init(s_MessageFlag* self UNUSED_PARAM,
 {
     PyErr_SetString(PyExc_NotImplementedError,
                     "MessageFlag can't be built directly");
-    return -1;
+    return (-1);
 }
 
 static void
@@ -140,7 +140,7 @@ MessageFlag_destroy(s_MessageFlag* self) {
 
 static PyObject*
 MessageFlag_getBit(s_MessageFlag* self) {
-    return Py_BuildValue("I", self->messageflag->getBit());
+    return (Py_BuildValue("I", self->messageflag->getBit()));
 }
 
 static PyObject*
@@ -154,37 +154,37 @@ MessageFlag_createStatic(const MessageFlag& flag) {
 
 static PyObject*
 MessageFlag_QR(s_MessageFlag* self UNUSED_PARAM) {
-    return MessageFlag_createStatic(MessageFlag::QR());
+    return (MessageFlag_createStatic(MessageFlag::QR()));
 }
 
 static PyObject*
 MessageFlag_AA(s_MessageFlag* self UNUSED_PARAM) {
-    return MessageFlag_createStatic(MessageFlag::AA());
+    return (MessageFlag_createStatic(MessageFlag::AA()));
 }
 
 static PyObject*
 MessageFlag_TC(s_MessageFlag* self UNUSED_PARAM) {
-    return MessageFlag_createStatic(MessageFlag::TC());
+    return (MessageFlag_createStatic(MessageFlag::TC()));
 }
 
 static PyObject*
 MessageFlag_RD(s_MessageFlag* self UNUSED_PARAM) {
-    return MessageFlag_createStatic(MessageFlag::RD());
+    return (MessageFlag_createStatic(MessageFlag::RD()));
 }
 
 static PyObject*
 MessageFlag_RA(s_MessageFlag* self UNUSED_PARAM) {
-    return MessageFlag_createStatic(MessageFlag::RA());
+    return (MessageFlag_createStatic(MessageFlag::RA()));
 }
 
 static PyObject*
 MessageFlag_AD(s_MessageFlag* self UNUSED_PARAM) {
-    return MessageFlag_createStatic(MessageFlag::AD());
+    return (MessageFlag_createStatic(MessageFlag::AD()));
 }
 
 static PyObject*
 MessageFlag_CD(s_MessageFlag* self UNUSED_PARAM) {
-    return MessageFlag_createStatic(MessageFlag::CD());
+    return (MessageFlag_createStatic(MessageFlag::CD()));
 }
 
 //
@@ -302,7 +302,7 @@ static int
 Opcode_init(s_Opcode* self UNUSED_PARAM, PyObject* args UNUSED_PARAM) {
     PyErr_SetString(PyExc_NotImplementedError,
                     "Opcode can't be built directly");
-    return -1;
+    return (-1);
 }
 
 static void
@@ -315,12 +315,12 @@ Opcode_destroy(s_Opcode* self) {
 
 static PyObject*
 Opcode_getCode(s_Opcode* self) {
-    return Py_BuildValue("I", self->opcode->getCode());
+    return (Py_BuildValue("I", self->opcode->getCode()));
 }
 
 static PyObject*
 Opcode_toText(s_Opcode* self) {
-    return Py_BuildValue("s", self->opcode->toText().c_str());
+    return (Py_BuildValue("s", self->opcode->toText().c_str()));
 }
 
 static PyObject*
@@ -342,82 +342,82 @@ Opcode_createStatic(const Opcode& opcode) {
 
 static PyObject*
 Opcode_QUERY(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::QUERY());
+    return (Opcode_createStatic(Opcode::QUERY()));
 }
 
 static PyObject*
 Opcode_IQUERY(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::IQUERY());
+    return (Opcode_createStatic(Opcode::IQUERY()));
 }
 
 static PyObject*
 Opcode_STATUS(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::STATUS());
+    return (Opcode_createStatic(Opcode::STATUS()));
 }
 
 static PyObject*
 Opcode_RESERVED3(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED3());
+    return (Opcode_createStatic(Opcode::RESERVED3()));
 }
 
 static PyObject*
 Opcode_NOTIFY(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::NOTIFY());
+    return (Opcode_createStatic(Opcode::NOTIFY()));
 }
 
 static PyObject*
 Opcode_UPDATE(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::UPDATE());
+    return (Opcode_createStatic(Opcode::UPDATE()));
 }
 
 static PyObject*
 Opcode_RESERVED6(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED6());
+    return (Opcode_createStatic(Opcode::RESERVED6()));
 }
 
 static PyObject*
 Opcode_RESERVED7(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED7());
+    return (Opcode_createStatic(Opcode::RESERVED7()));
 }
 
 static PyObject*
 Opcode_RESERVED8(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED8());
+    return (Opcode_createStatic(Opcode::RESERVED8()));
 }
 
 static PyObject*
 Opcode_RESERVED9(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED9());
+    return (Opcode_createStatic(Opcode::RESERVED9()));
 }
 
 static PyObject*
 Opcode_RESERVED10(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED10());
+    return (Opcode_createStatic(Opcode::RESERVED10()));
 }
 
 static PyObject*
 Opcode_RESERVED11(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED11());
+    return (Opcode_createStatic(Opcode::RESERVED11()));
 }
 
 static PyObject*
 Opcode_RESERVED12(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED12());
+    return (Opcode_createStatic(Opcode::RESERVED12()));
 }
 
 static PyObject*
 Opcode_RESERVED13(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED13());
+    return (Opcode_createStatic(Opcode::RESERVED13()));
 }
 
 static PyObject*
 Opcode_RESERVED14(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED14());
+    return (Opcode_createStatic(Opcode::RESERVED14()));
 }
 
 static PyObject*
 Opcode_RESERVED15(s_Opcode* self UNUSED_PARAM) {
-    return Opcode_createStatic(Opcode::RESERVED15());
+    return (Opcode_createStatic(Opcode::RESERVED15()));
 }
 
 static PyObject* 
@@ -434,11 +434,11 @@ Opcode_richcmp(s_Opcode* self, s_Opcode* other, int op) {
     switch (op) {
     case Py_LT:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Opcode");
-        return NULL;
+        return (NULL);
         break;
     case Py_LE:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Opcode");
-        return NULL;
+        return (NULL);
         break;
     case Py_EQ:
         c = (*self->opcode == *other->opcode);
@@ -448,11 +448,11 @@ Opcode_richcmp(s_Opcode* self, s_Opcode* other, int op) {
         break;
     case Py_GT:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Opcode");
-        return NULL;
+        return (NULL);
         break;
     case Py_GE:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Opcode");
-        return NULL;
+        return (NULL);
         break;
     }
     if (c)
@@ -592,11 +592,11 @@ Rcode_init(s_Rcode* self UNUSED_PARAM, PyObject* args UNUSED_PARAM) {
         } catch (isc::OutOfRange) {
             PyErr_SetString(PyExc_OverflowError,
                             "rcode out of range");
-            return -1;
+            return (-1);
         }
-        return 0;
+        return (0);
     } else {
-        return -1;
+        return (-1);
     }
 }
 
@@ -613,12 +613,12 @@ Rcode_destroy(s_Rcode* self) {
 
 static PyObject*
 Rcode_getCode(s_Rcode* self) {
-    return Py_BuildValue("I", self->rcode->getCode());
+    return (Py_BuildValue("I", self->rcode->getCode()));
 }
 
 static PyObject*
 Rcode_toText(s_Rcode* self) {
-    return Py_BuildValue("s", self->rcode->toText().c_str());
+    return (Py_BuildValue("s", self->rcode->toText().c_str()));
 }
 
 static PyObject*
@@ -641,87 +641,87 @@ Rcode_createStatic(const Rcode& rcode) {
 
 static PyObject*
 Rcode_NOERROR(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::NOERROR());
+    return (Rcode_createStatic(Rcode::NOERROR()));
 }
 
 static PyObject*
 Rcode_FORMERR(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::FORMERR());
+    return (Rcode_createStatic(Rcode::FORMERR()));
 }
 
 static PyObject*
 Rcode_SERVFAIL(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::SERVFAIL());
+    return (Rcode_createStatic(Rcode::SERVFAIL()));
 }
 
 static PyObject*
 Rcode_NXDOMAIN(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::NXDOMAIN());
+    return (Rcode_createStatic(Rcode::NXDOMAIN()));
 }
 
 static PyObject*
 Rcode_NOTIMP(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::NOTIMP());
+    return (Rcode_createStatic(Rcode::NOTIMP()));
 }
 
 static PyObject*
 Rcode_REFUSED(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::REFUSED());
+    return (Rcode_createStatic(Rcode::REFUSED()));
 }
 
 static PyObject*
 Rcode_YXDOMAIN(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::YXDOMAIN());
+    return (Rcode_createStatic(Rcode::YXDOMAIN()));
 }
 
 static PyObject*
 Rcode_YXRRSET(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::YXRRSET());
+    return (Rcode_createStatic(Rcode::YXRRSET()));
 }
 
 static PyObject*
 Rcode_NXRRSET(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::NXRRSET());
+    return (Rcode_createStatic(Rcode::NXRRSET()));
 }
 
 static PyObject*
 Rcode_NOTAUTH(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::NOTAUTH());
+    return (Rcode_createStatic(Rcode::NOTAUTH()));
 }
 
 static PyObject*
 Rcode_NOTZONE(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::NOTZONE());
+    return (Rcode_createStatic(Rcode::NOTZONE()));
 }
 
 static PyObject*
 Rcode_RESERVED11(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::RESERVED11());
+    return (Rcode_createStatic(Rcode::RESERVED11()));
 }
 
 static PyObject*
 Rcode_RESERVED12(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::RESERVED12());
+    return (Rcode_createStatic(Rcode::RESERVED12()));
 }
 
 static PyObject*
 Rcode_RESERVED13(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::RESERVED13());
+    return (Rcode_createStatic(Rcode::RESERVED13()));
 }
 
 static PyObject*
 Rcode_RESERVED14(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::RESERVED14());
+    return (Rcode_createStatic(Rcode::RESERVED14()));
 }
 
 static PyObject*
 Rcode_RESERVED15(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::RESERVED15());
+    return (Rcode_createStatic(Rcode::RESERVED15()));
 }
 
 static PyObject*
 Rcode_BADVERS(s_Rcode* self UNUSED_PARAM) {
-    return Rcode_createStatic(Rcode::BADVERS());
+    return (Rcode_createStatic(Rcode::BADVERS()));
 }
 
 static PyObject* 
@@ -738,11 +738,11 @@ Rcode_richcmp(s_Rcode* self, s_Rcode* other, int op) {
     switch (op) {
     case Py_LT:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Rcode");
-        return NULL;
+        return (NULL);
         break;
     case Py_LE:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Rcode");
-        return NULL;
+        return (NULL);
         break;
     case Py_EQ:
         c = (*self->rcode == *other->rcode);
@@ -752,11 +752,11 @@ Rcode_richcmp(s_Rcode* self, s_Rcode* other, int op) {
         break;
     case Py_GT:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Rcode");
-        return NULL;
+        return (NULL);
         break;
     case Py_GE:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Rcode");
-        return NULL;
+        return (NULL);
         break;
     }
     if (c)
@@ -858,7 +858,7 @@ Section_init(s_Section* self UNUSED_PARAM,
 {
     PyErr_SetString(PyExc_NotImplementedError,
                     "Section can't be built directly");
-    return -1;
+    return (-1);
 }
 
 static void
@@ -871,59 +871,37 @@ Section_destroy(s_Section* self) {
 
 static PyObject*
 Section_getCode(s_Section* self) {
-    return Py_BuildValue("I", self->section->getCode());
+    return (Py_BuildValue("I", self->section->getCode()));
 }
 
 static PyObject*
-Section_QUESTION(s_Section* self UNUSED_PARAM) {
+Section_createStatic(const Section& section) {
     s_Section* ret = PyObject_New(s_Section, &section_type);
     if (ret != NULL) {
-        ret->section = &Section::QUESTION();
-        if (ret->section == NULL) {
-            Py_DECREF(ret);
-            return NULL;
-        }
+        ret->section = &section;
     }
-    return static_cast<PyObject*>(ret);
+    return (ret);
+}
+
+
+static PyObject*
+Section_QUESTION(s_Section* self UNUSED_PARAM) {
+    return Section_createStatic(Section::QUESTION());
 }
 
 static PyObject*
 Section_ANSWER(s_Section* self UNUSED_PARAM) {
-    s_Section* ret = PyObject_New(s_Section, &section_type);
-    if (ret != NULL) {
-        ret->section = &Section::ANSWER();
-        if (ret->section == NULL) {
-            Py_DECREF(ret);
-            return NULL;
-        }
-    }
-    return static_cast<PyObject*>(ret);
+    return Section_createStatic(Section::ANSWER());
 }
 
 static PyObject*
 Section_AUTHORITY(s_Section* self UNUSED_PARAM) {
-    s_Section* ret = PyObject_New(s_Section, &section_type);
-    if (ret != NULL) {
-        ret->section = &Section::AUTHORITY();
-        if (ret->section == NULL) {
-            Py_DECREF(ret);
-            return NULL;
-        }
-    }
-    return static_cast<PyObject*>(ret);
+    return Section_createStatic(Section::AUTHORITY());
 }
 
 static PyObject*
 Section_ADDITIONAL(s_Section* self UNUSED_PARAM) {
-    s_Section* ret = PyObject_New(s_Section, &section_type);
-    if (ret != NULL) {
-        ret->section = &Section::ADDITIONAL();
-        if (ret->section == NULL) {
-            Py_DECREF(ret);
-            return NULL;
-        }
-    }
-    return static_cast<PyObject*>(ret);
+    return Section_createStatic(Section::ADDITIONAL());
 }
 
 static PyObject* 
@@ -940,11 +918,11 @@ Section_richcmp(s_Section* self, s_Section* other, int op) {
     switch (op) {
     case Py_LT:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Section");
-        return NULL;
+        return (NULL);
         break;
     case Py_LE:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Section");
-        return NULL;
+        return (NULL);
         break;
     case Py_EQ:
         c = (*self->section == *other->section);
@@ -954,11 +932,11 @@ Section_richcmp(s_Section* self, s_Section* other, int op) {
         break;
     case Py_GT:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Section");
-        return NULL;
+        return (NULL);
         break;
     case Py_GE:
         PyErr_SetString(PyExc_TypeError, "Unorderable type; Section");
-        return NULL;
+        return (NULL);
         break;
     }
     if (c)
@@ -1197,19 +1175,19 @@ Message_init(s_Message* self, PyObject* args) {
         PyErr_Clear();
         if (i == Message::PARSE) {
             self->message = new Message(Message::PARSE);
-            return 0;
+            return (0);
         } else if (i == Message::RENDER) {
             self->message = new Message(Message::RENDER);
-            return 0;
+            return (0);
         } else {
             PyErr_SetString(PyExc_TypeError, "Message mode must be Message.PARSE or Message.RENDER");
-            return -1;
+            return (-1);
         }
     }
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "no valid type in constructor argument");
-    return -1;
+    return (-1);
 }
 
 static void
@@ -1224,7 +1202,7 @@ static PyObject*
 Message_getHeaderFlag(s_Message* self, PyObject* args) {
     s_MessageFlag* messageflag;
     if (!PyArg_ParseTuple(args, "O!", &messageflag_type, &messageflag)) {
-        return NULL;
+        return (NULL);
     }
     
     if (self->message->getHeaderFlag(*messageflag->messageflag)) {
@@ -1238,7 +1216,7 @@ static PyObject*
 Message_setHeaderFlag(s_Message* self, PyObject* args) {
     s_MessageFlag* messageflag;
     if (!PyArg_ParseTuple(args, "O!", &messageflag_type, &messageflag)) {
-        return NULL;
+        return (NULL);
     }
 
     try {
@@ -1247,7 +1225,7 @@ Message_setHeaderFlag(s_Message* self, PyObject* args) {
     } catch (isc::dns::InvalidMessageOperation imo) {
         PyErr_Clear();
         PyErr_SetString(po_InvalidMessageOperation, imo.what());
-        return NULL;
+        return (NULL);
     }
 }
 
@@ -1255,7 +1233,7 @@ static PyObject*
 Message_clearHeaderFlag(s_Message* self, PyObject* args) {
     s_MessageFlag* messageflag;
     if (!PyArg_ParseTuple(args, "O!", &messageflag_type, &messageflag)) {
-        return NULL;
+        return (NULL);
     }
 
     try {
@@ -1264,7 +1242,7 @@ Message_clearHeaderFlag(s_Message* self, PyObject* args) {
     } catch (isc::dns::InvalidMessageOperation imo) {
         PyErr_Clear();
         PyErr_SetString(po_InvalidMessageOperation, imo.what());
-        return NULL;
+        return (NULL);
     }
 
     Py_RETURN_NONE;
@@ -1283,7 +1261,7 @@ static PyObject*
 Message_setDNSSECSupported(s_Message* self, PyObject* args) {
     PyObject *b;
     if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &b)) {
-        return NULL;
+        return (NULL);
     }
     try {
         if (b == Py_True) {
@@ -1294,50 +1272,50 @@ Message_setDNSSECSupported(s_Message* self, PyObject* args) {
         Py_RETURN_NONE;
     } catch (isc::dns::InvalidMessageOperation imo) {
         PyErr_SetString(po_InvalidMessageOperation, imo.what());
-        return NULL;
+        return (NULL);
     }
 }
 
 static PyObject*
 Message_getUDPSize(s_Message* self) {
-    return Py_BuildValue("I", self->message->getUDPSize());
+    return (Py_BuildValue("I", self->message->getUDPSize()));
 }
 
 static PyObject*
 Message_setUDPSize(s_Message* self, PyObject* args) {
     uint16_t size;
     if (!PyArg_ParseTuple(args, "I", &size)) {
-        return NULL;
+        return (NULL);
     }
     try {
         self->message->setUDPSize(size);
         Py_RETURN_NONE;
     } catch (isc::dns::InvalidMessageUDPSize imus) {
         PyErr_SetString(po_InvalidMessageUDPSize, imus.what());
-        return NULL;
+        return (NULL);
     } catch (isc::dns::InvalidMessageOperation imo) {
         PyErr_SetString(po_InvalidMessageOperation, imo.what());
-        return NULL;
+        return (NULL);
     }
 }
 
 static PyObject*
 Message_getQid(s_Message* self) {
-    return Py_BuildValue("I", self->message->getQid());
+    return (Py_BuildValue("I", self->message->getQid()));
 }
 
 static PyObject*
 Message_setQid(s_Message* self, PyObject* args) {
     uint16_t id;
     if (!PyArg_ParseTuple(args, "I", &id)) {
-        return NULL;
+        return (NULL);
     }
     try {
         self->message->setQid(id);
         Py_RETURN_NONE;
     } catch (InvalidMessageOperation imo) {
         PyErr_SetString(po_InvalidMessageOperation, imo.what());
-        return NULL;
+        return (NULL);
     }
 }
 
@@ -1351,25 +1329,25 @@ Message_getRcode(s_Message* self) {
         if (rcode->rcode == NULL)
           {
             Py_DECREF(rcode);
-            return NULL;
+            return (NULL);
           }
     }
 
-    return static_cast<PyObject*>(rcode);
+    return (rcode);
 }
 
 static PyObject*
 Message_setRcode(s_Message* self, PyObject* args) {
     s_Rcode* rcode;
     if (!PyArg_ParseTuple(args, "O!", &rcode_type, &rcode)) {
-        return NULL;
+        return (NULL);
     }
     try {
         self->message->setRcode(*rcode->rcode);
         Py_RETURN_NONE;
     } catch (InvalidMessageOperation imo) {
         PyErr_SetString(po_InvalidMessageOperation, imo.what());
-        return NULL;
+        return (NULL);
     }
 }
 
@@ -1386,25 +1364,25 @@ Message_getOpcode(s_Message* self) {
         if (opcode->opcode == NULL)
           {
             Py_DECREF(opcode);
-            return NULL;
+            return (NULL);
           }
     }
 
-    return static_cast<PyObject*>(opcode);
+    return (opcode);
 }
 
 static PyObject*
 Message_setOpcode(s_Message* self, PyObject* args) {
     s_Opcode* opcode;
     if (!PyArg_ParseTuple(args, "O!", &opcode_type, &opcode)) {
-        return NULL;
+        return (NULL);
     }
     try {
         self->message->setOpcode(*opcode->opcode);
         Py_RETURN_NONE;
     } catch (InvalidMessageOperation imo) {
         PyErr_SetString(po_InvalidMessageOperation, imo.what());
-        return NULL;
+        return (NULL);
     }
 }
 
@@ -1412,9 +1390,9 @@ static PyObject*
 Message_getRRCount(s_Message* self, PyObject* args) {
     s_Section *section;
     if (!PyArg_ParseTuple(args, "O!", &section_type, &section)) {
-        return NULL;
+        return (NULL);
     }
-    return Py_BuildValue("I", self->message->getRRCount(*section->section));
+    return (Py_BuildValue("I", self->message->getRRCount(*section->section)));
 }
 
 // TODO use direct iterators for these? (or simply lists for now?)
@@ -1431,19 +1409,19 @@ Message_getQuestion(s_Message* self) {
             if (question->question == NULL)
               {
                 Py_DECREF(question);
-                return NULL;
+                return (NULL);
               }
         }
-        PyList_Append(list, static_cast<PyObject*>(question));
+        PyList_Append(list, question);
     }
-    return list;
+    return (list);
 }
 
 static PyObject*
 Message_getSection(s_Message* self, PyObject* args) {
     s_Section *section;
     if (!PyArg_ParseTuple(args, "O!", &section_type, &section)) {
-        return NULL;
+        return (NULL);
     }
     PyObject* list = PyList_New(0);
     
@@ -1458,15 +1436,15 @@ Message_getSection(s_Message* self, PyObject* args) {
               {
                 Py_DECREF(rrset);
                 Py_DECREF(list);
-                return NULL;
+                return (NULL);
               }
         }
-        PyList_Append(list, static_cast<PyObject*>(rrset));
+        PyList_Append(list, rrset);
         // PyList_Append increases refcount, so we remove ours since
         // we don't need it anymore
         Py_DECREF(rrset);
     }
-    return list;
+    return (list);
 }
 
 //static PyObject* Message_beginQuestion(s_Message* self, PyObject* args);
@@ -1479,7 +1457,7 @@ Message_addQuestion(s_Message* self, PyObject* args) {
     s_Question *question;
 
     if (!PyArg_ParseTuple(args, "O!", &question_type, &question)) {
-        return NULL;
+        return (NULL);
     }
 
     self->message->addQuestion(question->question);
@@ -1495,7 +1473,7 @@ Message_addRRset(s_Message* self, PyObject* args) {
     if (!PyArg_ParseTuple(args, "O!O!|O!", &section_type, &section,
                                            &rrset_type, &rrset,
                                            &PyBool_Type, &sign)) {
-        return NULL;
+        return (NULL);
     }
 
     try {
@@ -1507,7 +1485,7 @@ Message_addRRset(s_Message* self, PyObject* args) {
         Py_RETURN_NONE;
     } catch (InvalidMessageOperation imo) {
         PyErr_SetString(po_InvalidMessageOperation, imo.what());
-        return NULL;
+        return (NULL);
     }
 }
 
@@ -1527,10 +1505,10 @@ Message_clear(s_Message* self, PyObject* args) {
             Py_RETURN_NONE;
         } else {
             PyErr_SetString(PyExc_TypeError, "Message mode must be Message.PARSE or Message.RENDER");
-            return NULL;
+            return (NULL);
         }
     } else {
-        return NULL;
+        return (NULL);
     }
 }
 
@@ -1543,7 +1521,7 @@ Message_makeResponse(s_Message* self) {
 static PyObject*
 Message_toText(s_Message* self) {
     // Py_BuildValue makes python objects from native data
-    return Py_BuildValue("s", self->message->toText().c_str());
+    return (Py_BuildValue("s", self->message->toText().c_str()));
 }
 
 static PyObject*
@@ -1567,13 +1545,13 @@ Message_toWire(s_Message* self, PyObject* args) {
         } catch (isc::dns::InvalidMessageOperation imo) {
             PyErr_Clear();
             PyErr_SetString(po_InvalidMessageOperation, imo.what());
-            return NULL;
+            return (NULL);
         }
     }
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "toWire argument must be a MessageRenderer");
-    return NULL;
+    return (NULL);
 }
 
 static PyObject*
@@ -1581,7 +1559,7 @@ Message_fromWire(s_Message* self, PyObject* args) {
     const char* b;
     Py_ssize_t len;
     if (!PyArg_ParseTuple(args, "y#", &b, &len)) {
-        return NULL;
+        return (NULL);
     }
     
     InputBuffer inbuf(b, len);
@@ -1590,16 +1568,16 @@ Message_fromWire(s_Message* self, PyObject* args) {
         Py_RETURN_NONE;
     } catch (isc::dns::InvalidMessageOperation imo) {
         PyErr_SetString(po_InvalidMessageOperation, imo.what());
-        return NULL;
+        return (NULL);
     } catch (isc::dns::DNSMessageFORMERR dmfe) {
         PyErr_SetString(po_DNSMessageFORMERR, dmfe.what());
-        return NULL;
+        return (NULL);
     } catch (isc::dns::DNSMessageBADVERS dmfe) {
         PyErr_SetString(po_DNSMessageBADVERS, dmfe.what());
-        return NULL;
+        return (NULL);
     } catch (isc::dns::MessageTooShort mts) {
         PyErr_SetString(po_MessageTooShort, mts.what());
-        return NULL;
+        return (NULL);
     }
 }
 
@@ -1609,7 +1587,7 @@ initModulePart_Message(PyObject* mod) {
     
     // add methods to class
     if (PyType_Ready(&messageflag_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&messageflag_type);
     PyModule_AddObject(mod, "MessageFlag",
@@ -1617,21 +1595,21 @@ initModulePart_Message(PyObject* mod) {
 
     
     if (PyType_Ready(&opcode_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&opcode_type);
     PyModule_AddObject(mod, "Opcode",
                        reinterpret_cast<PyObject*>(&opcode_type));
 
     if (PyType_Ready(&rcode_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&rcode_type);
     PyModule_AddObject(mod, "Rcode",
                        reinterpret_cast<PyObject*>(&rcode_type));
 
     if (PyType_Ready(&section_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&section_type);
     PyModule_AddObject(mod, "Section",
@@ -1639,7 +1617,7 @@ initModulePart_Message(PyObject* mod) {
 
     
     if (PyType_Ready(&message_type) < 0) {
-        return false;
+        return (false);
     }
     
     // Class variables
@@ -1666,5 +1644,5 @@ initModulePart_Message(PyObject* mod) {
                        reinterpret_cast<PyObject*>(&message_type));
 
 
-    return true;
+    return (true);
 }

+ 6 - 6
src/lib/dns/python/messagerenderer_python.cc

@@ -119,7 +119,7 @@ static int
 MessageRenderer_init(s_MessageRenderer* self) {
     self->outputbuffer = new OutputBuffer(4096);
     self->messagerenderer = new MessageRenderer(*self->outputbuffer);
-    return 0;
+    return (0);
 }
 
 static void
@@ -140,7 +140,7 @@ MessageRenderer_getData(s_MessageRenderer* self) {
 
 static PyObject*
 MessageRenderer_getLength(s_MessageRenderer* self) {
-    return Py_BuildValue("I", self->messagerenderer->getLength());
+    return (Py_BuildValue("I", self->messagerenderer->getLength()));
 }
 
 static PyObject*
@@ -154,7 +154,7 @@ MessageRenderer_isTruncated(s_MessageRenderer* self) {
 
 static PyObject*
 MessageRenderer_getLengthLimit(s_MessageRenderer* self) {
-    return Py_BuildValue("I", self->messagerenderer->getLengthLimit());
+    return (Py_BuildValue("I", self->messagerenderer->getLengthLimit()));
 }
 
 static PyObject*
@@ -169,7 +169,7 @@ MessageRenderer_setLengthLimit(s_MessageRenderer* self,
 {
     size_t lengthlimit;
     if (!PyArg_ParseTuple(args, "I", &lengthlimit)) {
-        return NULL;
+        return (NULL);
     }
     self->messagerenderer->setLengthLimit(lengthlimit);
     Py_RETURN_NONE;
@@ -193,13 +193,13 @@ initModulePart_MessageRenderer(PyObject* mod) {
 
     // NameComparisonResult
     if (PyType_Ready(&messagerenderer_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&messagerenderer_type);
     PyModule_AddObject(mod, "MessageRenderer",
                        reinterpret_cast<PyObject*>(&messagerenderer_type));
     
-    return true;
+    return (true);
 }
 
 

+ 43 - 43
src/lib/dns/python/name_python.cc

@@ -128,7 +128,7 @@ NameComparisonResult_init(s_NameComparisonResult* self UNUSED_PARAM,
 {
     PyErr_SetString(PyExc_NotImplementedError,
                     "NameComparisonResult can't be built directly");
-    return -1;
+    return (-1);
 }
 
 static void
@@ -140,17 +140,17 @@ NameComparisonResult_destroy(s_NameComparisonResult* self) {
 
 static PyObject* 
 NameComparisonResult_getOrder(s_NameComparisonResult* self) {
-    return Py_BuildValue("i", self->ncr->getOrder());
+    return (Py_BuildValue("i", self->ncr->getOrder()));
 }
 
 static PyObject* 
 NameComparisonResult_getCommonLabels(s_NameComparisonResult* self) {
-    return Py_BuildValue("I", self->ncr->getCommonLabels());
+    return (Py_BuildValue("I", self->ncr->getCommonLabels()));
 }
 
 static PyObject* 
 NameComparisonResult_getRelation(s_NameComparisonResult* self) {
-    return Py_BuildValue("I", self->ncr->getRelation());
+    return (Py_BuildValue("I", self->ncr->getRelation()));
 }
 
 // end of NameComparisonResult
@@ -293,32 +293,32 @@ Name_init(s_Name* self, PyObject* args) {
             self->position = 0;
         } catch (EmptyLabel) {
             PyErr_SetString(po_EmptyLabel, "EmptyLabel");
-            return -1;
+            return (-1);
         } catch (TooLongLabel) {
             PyErr_SetString(po_TooLongLabel, "TooLongLabel");
-            return -1;
+            return (-1);
         } catch (BadLabelType) {
             PyErr_SetString(po_BadLabelType, "BadLabelType");
-            return -1;
+            return (-1);
         } catch (BadEscape) {
             PyErr_SetString(po_BadEscape, "BadEscape");
-            return -1;
+            return (-1);
         } catch (TooLongName) {
             PyErr_SetString(po_TooLongName, "TooLongName");
-            return -1;
+            return (-1);
         } catch (IncompleteName) {
             PyErr_SetString(po_IncompleteName, "IncompleteName");
-            return -1;
+            return (-1);
 #ifdef CATCHMEMERR
         } catch (std::bad_alloc) {
             PyErr_NoMemory();
-            return -1;
+            return (-1);
 #endif
         } catch (...) {
             PyErr_SetString(po_IscException, "Unexpected?!");
-            return -1;
+            return (-1);
         }
-        return 0;
+        return (0);
     }
     PyErr_Clear();
 
@@ -341,21 +341,21 @@ Name_init(s_Name* self, PyObject* args) {
         } catch (InvalidBufferPosition) {
             PyErr_SetString(po_InvalidBufferPosition,
                             "InvalidBufferPosition");
-            return -1;
+            return (-1);
         } catch (DNSMessageFORMERR) {
             PyErr_SetString(po_DNSMessageFORMERR, "DNSMessageFORMERR");
-            return -1;
+            return (-1);
         } catch (...) {
             PyErr_SetString(po_IscException, "Unexpected?!");
-            return -1;
+            return (-1);
         }
-        return 0;
+        return (0);
     }
 
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "No valid types in Name constructor (should be string or sequence and offset");
-    return -1;
+    return (-1);
 }
 
 static void
@@ -369,30 +369,30 @@ static PyObject*
 Name_at(s_Name* self, PyObject* args) {
     size_t pos;
     if (!PyArg_ParseTuple(args, "i", &pos)) {
-        return NULL;
+        return (NULL);
     }
     try {
-        return Py_BuildValue("i", self->name->at(pos));
+        return (Py_BuildValue("i", self->name->at(pos)));
     } catch (isc::OutOfRange oor) {
         PyErr_SetString(PyExc_IndexError,
                         "name index out of range");
-        return NULL;
+        return (NULL);
     }
 }
 
 static PyObject*
 Name_getLength(s_Name* self) {
-    return Py_BuildValue("i", self->name->getLength());
+    return (Py_BuildValue("i", self->name->getLength()));
 }
 
 static PyObject*
 Name_getLabelCount(s_Name* self) {
-    return Py_BuildValue("i", self->name->getLabelCount());
+    return (Py_BuildValue("i", self->name->getLabelCount()));
 }
 
 static PyObject*
 Name_toText(s_Name* self) {
-    return Py_BuildValue("s", self->name->toText().c_str());
+    return (Py_BuildValue("s", self->name->toText().c_str()));
 }
 
 static PyObject*
@@ -420,7 +420,7 @@ Name_toWire(s_Name* self, PyObject* args) {
         // We need to release the object we temporarily created here
         // to prevent memory leak
         Py_DECREF(name_bytes);
-        return result;
+        return (result);
     } else if (PyArg_ParseTuple(args, "O!", &messagerenderer_type, (PyObject**) &mr)) {
         self->name->toWire(*mr->messagerenderer);
         // If we return NULL it is seen as an error, so use this for
@@ -430,7 +430,7 @@ Name_toWire(s_Name* self, PyObject* args) {
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "toWire argument must be a sequence object or a MessageRenderer");
-    return NULL;
+    return (NULL);
 }
 
 static PyObject*
@@ -438,14 +438,14 @@ Name_compare(s_Name* self, PyObject* args) {
     s_Name* other;
 
     if (!PyArg_ParseTuple(args, "O!", &name_type, (PyObject* *) &other))
-        return NULL;
+        return (NULL);
 
     s_NameComparisonResult* ret = PyObject_New(s_NameComparisonResult, &name_comparison_result_type);
     if (ret != NULL) {
         ret->ncr = new NameComparisonResult(
             self->name->compare(*other->name));
     }
-    return static_cast<PyObject*>(ret);
+    return (ret);
 }
 
 static PyObject* 
@@ -453,7 +453,7 @@ Name_equals(s_Name* self, PyObject* args) {
     s_Name* other;
 
     if (!PyArg_ParseTuple(args, "O!", &name_type, (PyObject* *) &other))
-        return NULL;
+        return (NULL);
 
     if (self->name->equals(*other->name))
         Py_RETURN_TRUE;
@@ -478,7 +478,7 @@ Name_split(s_Name* self, PyObject* args) {
             }
             if (ret->name == NULL) {
                 Py_DECREF(ret);
-                return NULL;
+                return (NULL);
             }
         }
     } else if (PyArg_ParseTuple(args, "I", &n)) {
@@ -493,11 +493,11 @@ Name_split(s_Name* self, PyObject* args) {
             }
             if (ret->name == NULL) {
                 Py_DECREF(ret);
-                return NULL;
+                return (NULL);
             }
         }
     }
-    return static_cast<PyObject*>(ret);
+    return (ret);
 }
 #include <iostream>
 
@@ -538,7 +538,7 @@ Name_richcmp(s_Name* self, s_Name* other, int op) {
     default:
         PyErr_SetString(PyExc_IndexError,
                         "Unhandled rich comparison operator");
-        return NULL;
+        return (NULL);
     }
     if (c) {
         Py_RETURN_TRUE;
@@ -555,10 +555,10 @@ Name_reverse(s_Name* self) {
         ret->name = new Name(self->name->reverse());
         if (ret->name == NULL) {
             Py_DECREF(ret);
-            return NULL;
+            return (NULL);
         }
     }
-    return static_cast<PyObject*>(ret);
+    return (ret);
 }
 
 static PyObject*
@@ -566,7 +566,7 @@ Name_concatenate(s_Name* self, PyObject* args) {
     s_Name* other;
 
     if (!PyArg_ParseTuple(args, "O!", &name_type, (PyObject**) &other))
-        return NULL;
+        return (NULL);
 
     s_Name* ret = PyObject_New(s_Name, &name_type);
     if (ret != NULL) {
@@ -574,17 +574,17 @@ Name_concatenate(s_Name* self, PyObject* args) {
             ret->name = new Name(self->name->concatenate(*other->name));
         } catch (isc::dns::TooLongName tln) {
             PyErr_SetString(po_TooLongName, tln.what());
-            return NULL;
+            return (NULL);
         }
     }
-    return static_cast<PyObject*>(ret);
+    return (ret);
 }
 
 static PyObject*
 Name_downcase(s_Name* self) {
     self->name->downcase();
     Py_INCREF(self);
-    return static_cast<PyObject*>(self);
+    return (self);
 }
 
 static PyObject*
@@ -609,7 +609,7 @@ initModulePart_Name(PyObject* mod) {
     // NameComparisonResult
     //
     if (PyType_Ready(&name_comparison_result_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&name_comparison_result_type);
 
@@ -629,7 +629,7 @@ initModulePart_Name(PyObject* mod) {
     //
     
     if (PyType_Ready(&name_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&name_type);
 
@@ -643,7 +643,7 @@ initModulePart_Name(PyObject* mod) {
 
     s_Name* root_name = PyObject_New(s_Name, &name_type);
     root_name->name = new Name(".");
-    PyObject* po_ROOT_NAME = static_cast<PyObject*>(root_name);
+    PyObject* po_ROOT_NAME = root_name;
     Py_INCREF(po_ROOT_NAME);
     addClassVariable(name_type, "ROOT_NAME", po_ROOT_NAME);
 
@@ -678,5 +678,5 @@ initModulePart_Name(PyObject* mod) {
     po_DNSMessageFORMERR = PyErr_NewException("libdns_python.DNSMessageFORMERR", NULL, NULL);
     PyModule_AddObject(mod, "DNSMessageFORMERR", po_DNSMessageFORMERR);
 
-    return true;
+    return (true);
 }

+ 14 - 14
src/lib/dns/python/question_python.cc

@@ -148,26 +148,26 @@ Question_init(s_Question* self, PyObject* args) {
            )) {
             self->question = QuestionPtr(new Question(*name->name, *rrclass->rrclass,
                                           *rrtype->rrtype));
-            return 0;
+            return (0);
         } else if (PyArg_ParseTuple(args, "y#|I", &b, &len, &position)) {
             PyErr_Clear();
             InputBuffer inbuf(b, len);
             inbuf.setPosition(position);
             self->question = QuestionPtr(new Question(inbuf));
-            return 0;
+            return (0);
         }
     } catch (isc::dns::DNSMessageFORMERR dmfe) {
         PyErr_Clear();
         PyErr_SetString(po_DNSMessageFORMERR, dmfe.what());
-        return -1;
+        return (-1);
     } catch (isc::dns::IncompleteRRClass irc) {
         PyErr_Clear();
         PyErr_SetString(po_IncompleteRRClass, irc.what());
-        return -1;
+        return (-1);
     } catch (isc::dns::IncompleteRRType irt) {
         PyErr_Clear();
         PyErr_SetString(po_IncompleteRRType, irt.what());
-        return -1;
+        return (-1);
     }
 
     self->question = QuestionPtr();
@@ -175,7 +175,7 @@ Question_init(s_Question* self, PyObject* args) {
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "no valid type in constructor argument");
-    return -1;
+    return (-1);
 }
 
 static void
@@ -194,7 +194,7 @@ Question_getName(s_Question* self) {
         name->name = new Name(self->question->getName());
     }
 
-    return static_cast<PyObject*>(name);
+    return (name);
 }
 
 static PyObject*
@@ -206,7 +206,7 @@ Question_getType(s_Question* self) {
         rrtype->rrtype = new RRType(self->question->getType());
     }
 
-    return static_cast<PyObject*>(rrtype);
+    return (rrtype);
 }
 
 static PyObject*
@@ -218,14 +218,14 @@ Question_getClass(s_Question* self) {
         rrclass->rrclass = new RRClass(self->question->getClass());
     }
 
-    return static_cast<PyObject*>(rrclass);
+    return (rrclass);
 }
 
 
 static PyObject*
 Question_toText(s_Question* self) {
     // Py_BuildValue makes python objects from native data
-    return Py_BuildValue("s", self->question->toText().c_str());
+    return (Py_BuildValue("s", self->question->toText().c_str()));
 }
 
 static PyObject*
@@ -253,7 +253,7 @@ Question_toWire(s_Question* self, PyObject* args) {
         // We need to release the object we temporarily created here
         // to prevent memory leak
         Py_DECREF(n);
-        return result;
+        return (result);
     } else if (PyArg_ParseTuple(args, "O!", &messagerenderer_type,
                                 reinterpret_cast<PyObject**>(&mr))) {
         self->question->toWire(*mr->messagerenderer);
@@ -264,7 +264,7 @@ Question_toWire(s_Question* self, PyObject* args) {
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "toWire argument must be a sequence object or a MessageRenderer");
-    return NULL;
+    return (NULL);
 }
 
 // end of Question
@@ -279,11 +279,11 @@ initModulePart_Question(PyObject* mod) {
     // then add it to the module. This is not just a check! (leaving
     // this out results in segmentation faults)
     if (PyType_Ready(&question_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&question_type);
     PyModule_AddObject(mod, "Question",
                        reinterpret_cast<PyObject*>(&question_type));
     
-    return true;
+    return (true);
 }

+ 8 - 8
src/lib/dns/python/rdata_python.cc

@@ -151,10 +151,10 @@ Rdata_init(s_Rdata* self, PyObject* args) {
                                         &rrclass_type, &rrclass,
                                         &s)) {
         self->rdata = createRdata(*rrtype->rrtype, *rrclass->rrclass, s);
-        return 0;
+        return (0);
     }
 
-    return -1;
+    return (-1);
 }
 
 static void
@@ -168,7 +168,7 @@ Rdata_destroy(s_Rdata* self) {
 static PyObject*
 Rdata_toText(s_Rdata* self) {
     // Py_BuildValue makes python objects from native data
-    return Py_BuildValue("s", self->rdata->toText().c_str());
+    return (Py_BuildValue("s", self->rdata->toText().c_str()));
 }
 
 static PyObject*
@@ -194,7 +194,7 @@ Rdata_toWire(s_Rdata* self, PyObject* args) {
         // We need to release the object we temporarily created here
         // to prevent memory leak
         Py_DECREF(rd_bytes);
-        return result;
+        return (result);
     } else if (PyArg_ParseTuple(args, "O!", &messagerenderer_type, (PyObject**) &mr)) {
         self->rdata->toWire(*mr->messagerenderer);
         // If we return NULL it is seen as an error, so use this for
@@ -204,7 +204,7 @@ Rdata_toWire(s_Rdata* self, PyObject* args) {
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "toWire argument must be a sequence object or a MessageRenderer");
-    return NULL;
+    return (NULL);
 }
 
 
@@ -243,7 +243,7 @@ RData_richcmp(s_Rdata* self, s_Rdata* other, int op) {
     default:
         PyErr_SetString(PyExc_IndexError,
                         "Unhandled rich comparison operator");
-        return NULL;
+        return (NULL);
     }
     if (c)
         Py_RETURN_TRUE;
@@ -260,7 +260,7 @@ initModulePart_Rdata(PyObject* mod) {
     // then add it to the module. This is not just a check! (leaving
     // this out results in segmentation faults)
     if (PyType_Ready(&rdata_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&rdata_type);
     PyModule_AddObject(mod, "Rdata",
@@ -277,5 +277,5 @@ initModulePart_Rdata(PyObject* mod) {
     PyModule_AddObject(mod, "CharStringTooLong", po_CharStringTooLong);
 
     
-    return true;
+    return (true);
 }

+ 20 - 20
src/lib/dns/python/rrclass_python.cc

@@ -166,37 +166,37 @@ RRClass_init(s_RRClass* self, PyObject* args) {
     try {
         if (PyArg_ParseTuple(args, "s", &s)) {
             self->rrclass = new RRClass(s);
-            return 0;
+            return (0);
         } else if (PyArg_ParseTuple(args, "I", &i)) {
             PyErr_Clear();
             if (i > 65535) {
                 PyErr_SetString(po_InvalidRRClass, "Class number too high");
-                return -1;
+                return (-1);
             }
             self->rrclass = new RRClass(i);
-            return 0;
+            return (0);
         } else if (PyArg_ParseTuple(args, "O", &bytes) && PySequence_Check(bytes)) {
             uint8_t data[2];
             int result = readDataFromSequence(data, 2, bytes);
             if (result != 0) {
-                return result;
+                return (result);
             }
             InputBuffer ib(data, 2);
             self->rrclass = new RRClass(ib);
             PyErr_Clear();
-            return 0;
+            return (0);
         }
     // Incomplete is never thrown, a type error would have already been raised
     //when we try to read the 2 bytes above
     } catch (InvalidRRClass ic) {
         PyErr_Clear();
         PyErr_SetString(po_InvalidRRClass, ic.what());
-        return -1;
+        return (-1);
     }
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "no valid type in constructor argument");
-    return -1;
+    return (-1);
 }
 
 static void
@@ -210,7 +210,7 @@ RRClass_destroy(s_RRClass* self) {
 static PyObject*
 RRClass_toText(s_RRClass* self) {
     // Py_BuildValue makes python objects from native data
-    return Py_BuildValue("s", self->rrclass->toText().c_str());
+    return (Py_BuildValue("s", self->rrclass->toText().c_str()));
 }
 
 static PyObject*
@@ -236,7 +236,7 @@ RRClass_toWire(s_RRClass* self, PyObject* args) {
         // We need to release the object we temporarily created here
         // to prevent memory leak
         Py_DECREF(n);
-        return result;
+        return (result);
     } else if (PyArg_ParseTuple(args, "O!", &messagerenderer_type, (PyObject**) &mr)) {
         self->rrclass->toWire(*mr->messagerenderer);
         // If we return NULL it is seen as an error, so use this for
@@ -246,12 +246,12 @@ RRClass_toWire(s_RRClass* self, PyObject* args) {
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "toWire argument must be a sequence object or a MessageRenderer");
-    return NULL;
+    return (NULL);
 }
 
 static PyObject*
 RRClass_getCode(s_RRClass* self) {
-    return Py_BuildValue("I", self->rrclass->getCode());
+    return (Py_BuildValue("I", self->rrclass->getCode()));
 }
 
 static PyObject* 
@@ -288,7 +288,7 @@ RRClass_richcmp(s_RRClass* self, s_RRClass* other, int op) {
     default:
         PyErr_SetString(PyExc_IndexError,
                         "Unhandled rich comparison operator");
-        return NULL;
+        return (NULL);
     }
     if (c)
         Py_RETURN_TRUE;
@@ -304,27 +304,27 @@ static PyObject* RRClass_createStatic(RRClass stc) {
     if (ret != NULL) {
         ret->rrclass = new RRClass(stc);
     }
-    return static_cast<PyObject*>(ret);
+    return (ret);
 }
 
 static PyObject* RRClass_IN(s_RRClass *self UNUSED_PARAM) {
-    return RRClass_createStatic(RRClass::IN());
+    return (RRClass_createStatic(RRClass::IN()));
 }
 
 static PyObject* RRClass_CH(s_RRClass *self UNUSED_PARAM) {
-    return RRClass_createStatic(RRClass::CH());
+    return (RRClass_createStatic(RRClass::CH()));
 }
 
 static PyObject* RRClass_HS(s_RRClass *self UNUSED_PARAM) {
-    return RRClass_createStatic(RRClass::HS());
+    return (RRClass_createStatic(RRClass::HS()));
 }
 
 static PyObject* RRClass_NONE(s_RRClass *self UNUSED_PARAM) {
-    return RRClass_createStatic(RRClass::NONE());
+    return (RRClass_createStatic(RRClass::NONE()));
 }
 
 static PyObject* RRClass_ANY(s_RRClass *self UNUSED_PARAM) {
-    return RRClass_createStatic(RRClass::ANY());
+    return (RRClass_createStatic(RRClass::ANY()));
 }
 // end of RRClass
 
@@ -344,11 +344,11 @@ initModulePart_RRClass(PyObject* mod) {
     // then add it to the module. This is not just a check! (leaving
     // this out results in segmentation faults)
     if (PyType_Ready(&rrclass_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&rrclass_type);
     PyModule_AddObject(mod, "RRClass",
                        reinterpret_cast<PyObject*>(&rrclass_type));
     
-    return true;
+    return (true);
 }

+ 25 - 25
src/lib/dns/python/rrset_python.cc

@@ -171,11 +171,11 @@ RRset_init(s_RRset* self, PyObject* args UNUSED_PARAM) {
        )) {
         self->rrset = RRsetPtr(new RRset(*name->name, *rrclass->rrclass,
                                 *rrtype->rrtype, *rrttl->rrttl));
-        return 0;
+        return (0);
     }
 
     self->rrset = RRsetPtr();
-    return -1;
+    return (-1);
 }
 
 static void
@@ -188,7 +188,7 @@ RRset_destroy(s_RRset* self) {
 
 static PyObject*
 RRset_getRdataCount(s_RRset* self) {
-    return Py_BuildValue("I", self->rrset->getRdataCount());
+    return (Py_BuildValue("I", self->rrset->getRdataCount()));
 }
 
 static PyObject*
@@ -202,11 +202,11 @@ RRset_getName(s_RRset* self) {
         if (name->name == NULL)
           {
             Py_DECREF(name);
-            return NULL;
+            return (NULL);
           }
     }
 
-    return static_cast<PyObject*>(name);
+    return (name);
 }
 
 static PyObject*
@@ -219,11 +219,11 @@ RRset_getClass(s_RRset* self) {
         if (rrclass->rrclass == NULL)
           {
             Py_DECREF(rrclass);
-            return NULL;
+            return (NULL);
           }
     }
 
-    return static_cast<PyObject*>(rrclass);
+    return (rrclass);
 }
 
 static PyObject*
@@ -236,11 +236,11 @@ RRset_getType(s_RRset* self) {
         if (rrtype->rrtype == NULL)
           {
             Py_DECREF(rrtype);
-            return NULL;
+            return (NULL);
           }
     }
 
-    return static_cast<PyObject*>(rrtype);
+    return (rrtype);
 }
 
 static PyObject*
@@ -253,18 +253,18 @@ RRset_getTTL(s_RRset* self) {
         if (rrttl->rrttl == NULL)
           {
             Py_DECREF(rrttl);
-            return NULL;
+            return (NULL);
           }
     }
 
-    return static_cast<PyObject*>(rrttl);
+    return (rrttl);
 }
 
 static PyObject*
 RRset_setName(s_RRset* self, PyObject* args) {
     s_Name* name;
     if (!PyArg_ParseTuple(args, "O!", &name_type, &name)) {
-        return NULL;
+        return (NULL);
     }
     self->rrset->setName(*name->name);
     Py_RETURN_NONE;
@@ -274,7 +274,7 @@ static PyObject*
 RRset_setTTL(s_RRset* self, PyObject* args) {
     s_RRTTL* rrttl;
     if (!PyArg_ParseTuple(args, "O!", &rrttl_type, &rrttl)) {
-        return NULL;
+        return (NULL);
     }
     self->rrset->setTTL(*rrttl->rrttl);
     Py_RETURN_NONE;
@@ -283,10 +283,10 @@ RRset_setTTL(s_RRset* self, PyObject* args) {
 static PyObject*
 RRset_toText(s_RRset* self) {
     try {
-        return Py_BuildValue("s", self->rrset->toText().c_str());
+        return (Py_BuildValue("s", self->rrset->toText().c_str()));
     } catch (EmptyRRset ers) {
         PyErr_SetString(po_EmptyRRset, ers.what());
-        return NULL;
+        return (NULL);
     }
 }
 
@@ -314,7 +314,7 @@ RRset_toWire(s_RRset* self, PyObject* args) {
             // We need to release the object we temporarily created here
             // to prevent memory leak
             Py_DECREF(n);
-            return result;
+            return (result);
         } else if (PyArg_ParseTuple(args, "O!", &messagerenderer_type, (PyObject**) &mr)) {
             self->rrset->toWire(*mr->messagerenderer);
             // If we return NULL it is seen as an error, so use this for
@@ -324,19 +324,19 @@ RRset_toWire(s_RRset* self, PyObject* args) {
     } catch (EmptyRRset ers) {
         PyErr_Clear();
         PyErr_SetString(po_EmptyRRset, ers.what());
-        return NULL;
+        return (NULL);
     }
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "toWire argument must be a sequence object or a MessageRenderer");
-    return NULL;
+    return (NULL);
 }
 
 static PyObject*
 RRset_addRdata(s_RRset* self, PyObject* args) {
     s_Rdata* rdata;
     if (!PyArg_ParseTuple(args, "O!", &rdata_type, &rdata)) {
-        return NULL;
+        return (NULL);
     }
     try {
         self->rrset->addRdata(*rdata->rdata);
@@ -345,7 +345,7 @@ RRset_addRdata(s_RRset* self, PyObject* args) {
         PyErr_Clear();
         PyErr_SetString(PyExc_TypeError,
                         "Rdata type to add must match type of RRset");
-        return NULL;
+        return (NULL);
     }
 }
 
@@ -363,13 +363,13 @@ RRset_getRdata(s_RRset* self) {
             // the data available
             const Rdata *rd = &it->getCurrent();
             rds->rdata = createRdata(self->rrset->getType(), self->rrset->getClass(), *rd);
-            PyList_Append(list, static_cast<PyObject*>(rds));
+            PyList_Append(list, rds);
         } else {
-            return NULL;
+            return (NULL);
         }
     }
     
-    return list;
+    return (list);
 }
 
 // end of RRset
@@ -392,12 +392,12 @@ initModulePart_RRset(PyObject* mod) {
 
     // NameComparisonResult
     if (PyType_Ready(&rrset_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&rrset_type);
     PyModule_AddObject(mod, "RRset",
                        reinterpret_cast<PyObject*>(&rrset_type));
     
-    return true;
+    return (true);
 }
 

+ 13 - 13
src/lib/dns/python/rrttl_python.cc

@@ -155,22 +155,22 @@ RRTTL_init(s_RRTTL* self, PyObject* args) {
     try {
         if (PyArg_ParseTuple(args, "s", &s)) {
             self->rrttl = new RRTTL(s);
-            return 0;
+            return (0);
         } else if (PyArg_ParseTuple(args, "I", &i)) {
             PyErr_Clear();
             self->rrttl = new RRTTL(i);
-            return 0;
+            return (0);
         } else if (PyArg_ParseTuple(args, "O", &bytes) && PySequence_Check(bytes)) {
             Py_ssize_t size = PySequence_Size(bytes);
             uint8_t data[size];
             int result = readDataFromSequence(data, size, bytes);
             if (result != 0) {
-                return result;
+                return (result);
             }
             InputBuffer ib(data, size);
             self->rrttl = new RRTTL(ib);
             PyErr_Clear();
-            return 0;
+            return (0);
         }
     } catch (IncompleteRRTTL icc) {
         // Ok so one of our functions has thrown a C++ exception.
@@ -180,16 +180,16 @@ RRTTL_init(s_RRTTL* self, PyObject* args) {
         // Now set our own exception
         PyErr_SetString(po_IncompleteRRTTL, icc.what());
         // And return negative
-        return -1;
+        return (-1);
     } catch (InvalidRRTTL ic) {
         PyErr_Clear();
         PyErr_SetString(po_InvalidRRTTL, ic.what());
-        return -1;
+        return (-1);
     }
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "no valid type in constructor argument");
-    return -1;
+    return (-1);
 }
 
 static void
@@ -203,7 +203,7 @@ RRTTL_destroy(s_RRTTL* self) {
 static PyObject*
 RRTTL_toText(s_RRTTL* self) {
     // Py_BuildValue makes python objects from native data
-    return Py_BuildValue("s", self->rrttl->toText().c_str());
+    return (Py_BuildValue("s", self->rrttl->toText().c_str()));
 }
 
 static PyObject*
@@ -229,7 +229,7 @@ RRTTL_toWire(s_RRTTL* self, PyObject* args) {
         // We need to release the object we temporarily created here
         // to prevent memory leak
         Py_DECREF(n);
-        return result;
+        return (result);
     } else if (PyArg_ParseTuple(args, "O!", &messagerenderer_type, (PyObject**) &mr)) {
         self->rrttl->toWire(*mr->messagerenderer);
         // If we return NULL it is seen as an error, so use this for
@@ -239,12 +239,12 @@ RRTTL_toWire(s_RRTTL* self, PyObject* args) {
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "toWire argument must be a sequence object or a MessageRenderer");
-    return NULL;
+    return (NULL);
 }
 
 static PyObject*
 RRTTL_getValue(s_RRTTL* self) {
-    return Py_BuildValue("I", self->rrttl->getValue());
+    return (Py_BuildValue("I", self->rrttl->getValue()));
 }
 
 static PyObject* 
@@ -300,11 +300,11 @@ initModulePart_RRTTL(PyObject* mod) {
     // then add it to the module. This is not just a check! (leaving
     // this out results in segmentation faults)
     if (PyType_Ready(&rrttl_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&rrttl_type);
     PyModule_AddObject(mod, "RRTTL",
                        reinterpret_cast<PyObject*>(&rrttl_type));
     
-    return true;
+    return (true);
 }

+ 34 - 35
src/lib/dns/python/rrtype_python.cc

@@ -192,26 +192,26 @@ RRType_init(s_RRType* self, PyObject* args) {
     try {
         if (PyArg_ParseTuple(args, "s", &s)) {
             self->rrtype = new RRType(s);
-            return 0;
+            return (0);
         } else if (PyArg_ParseTuple(args, "I", &i)) {
             PyErr_Clear();
             if (i > 65535) {
                 PyErr_SetString(po_InvalidRRType, "Class number too high");
-                return -1;
+                return (-1);
             }
             self->rrtype = new RRType(i);
-            return 0;
+            return (0);
         } else if (PyArg_ParseTuple(args, "O", &bytes) && PySequence_Check(bytes)) {
             Py_ssize_t size = PySequence_Size(bytes);
             uint8_t data[size];
             int result = readDataFromSequence(data, size, bytes);
             if (result != 0) {
-                return result;
+                return (result);
             }
             InputBuffer ib(data, size);
             self->rrtype = new RRType(ib);
             PyErr_Clear();
-            return 0;
+            return (0);
         }
     } catch (IncompleteRRType icc) {
         // Ok so one of our functions has thrown a C++ exception.
@@ -221,16 +221,16 @@ RRType_init(s_RRType* self, PyObject* args) {
         // Now set our own exception
         PyErr_SetString(po_IncompleteRRType, icc.what());
         // And return negative
-        return -1;
+        return (-1);
     } catch (InvalidRRType ic) {
         PyErr_Clear();
         PyErr_SetString(po_InvalidRRType, ic.what());
-        return -1;
+        return (-1);
     }
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "no valid type in constructor argument");
-    return -1;
+    return (-1);
 }
 
 static void
@@ -244,7 +244,7 @@ RRType_destroy(s_RRType* self) {
 static PyObject*
 RRType_toText(s_RRType* self) {
     // Py_BuildValue makes python objects from native data
-    return Py_BuildValue("s", self->rrtype->toText().c_str());
+    return (Py_BuildValue("s", self->rrtype->toText().c_str()));
 }
 
 static PyObject*
@@ -269,7 +269,7 @@ RRType_toWire(s_RRType* self, PyObject* args) {
         // We need to release the object we temporarily created here
         // to prevent memory leak
         Py_DECREF(n);
-        return result;
+        return (result);
     } else if (PyArg_ParseTuple(args, "O!", &messagerenderer_type, (PyObject**) &mr)) {
         self->rrtype->toWire(*mr->messagerenderer);
         // If we return NULL it is seen as an error, so use this for
@@ -279,12 +279,12 @@ RRType_toWire(s_RRType* self, PyObject* args) {
     PyErr_Clear();
     PyErr_SetString(PyExc_TypeError,
                     "toWire argument must be a sequence object or a MessageRenderer");
-    return NULL;
+    return (NULL);
 }
 
 static PyObject*
 RRType_getCode(s_RRType* self) {
-    return Py_BuildValue("I", self->rrtype->getCode());
+    return (Py_BuildValue("I", self->rrtype->getCode()));
 }
 
 static PyObject* 
@@ -321,7 +321,7 @@ RRType_richcmp(s_RRType* self, s_RRType* other, int op) {
     default:
         PyErr_SetString(PyExc_IndexError,
                         "Unhandled rich comparison operator");
-        return NULL;
+        return (NULL);
     }
     if (c)
         Py_RETURN_TRUE;
@@ -337,103 +337,102 @@ static PyObject* RRType_createStatic(RRType stc) {
     if (ret != NULL) {
         ret->rrtype = new RRType(stc);
     }
-    //return static_cast<PyObject*>(ret);
     return (ret);
 }
 
 static PyObject*
 RRType_NSEC3PARAM(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::NSEC3PARAM());
+    return (RRType_createStatic(RRType::NSEC3PARAM()));
 }
 
 static PyObject*
 RRType_DNAME(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::DNAME());
+    return (RRType_createStatic(RRType::DNAME()));
 }
 
 static PyObject*
 RRType_PTR(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::PTR());
+    return (RRType_createStatic(RRType::PTR()));
 }
 
 static PyObject*
 RRType_MX(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::MX());
+    return (RRType_createStatic(RRType::MX()));
 }
 
 static PyObject*
 RRType_DNSKEY(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::DNSKEY());
+    return (RRType_createStatic(RRType::DNSKEY()));
 }
 
 static PyObject*
 RRType_TXT(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::TXT());
+    return (RRType_createStatic(RRType::TXT()));
 }
 
 static PyObject*
 RRType_RRSIG(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::RRSIG());
+    return (RRType_createStatic(RRType::RRSIG()));
 }
 
 static PyObject*
 RRType_NSEC(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::NSEC());
+    return (RRType_createStatic(RRType::NSEC()));
 }
 
 static PyObject*
 RRType_AAAA(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::AAAA());
+    return (RRType_createStatic(RRType::AAAA()));
 }
 
 static PyObject*
 RRType_DS(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::DS());
+    return (RRType_createStatic(RRType::DS()));
 }
 
 static PyObject*
 RRType_OPT(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::OPT());
+    return (RRType_createStatic(RRType::OPT()));
 }
 
 static PyObject*
 RRType_A(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::A());
+    return (RRType_createStatic(RRType::A()));
 }
 
 static PyObject*
 RRType_NS(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::NS());
+    return (RRType_createStatic(RRType::NS()));
 }
 
 static PyObject*
 RRType_CNAME(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::CNAME());
+    return (RRType_createStatic(RRType::CNAME()));
 }
 
 static PyObject*
 RRType_SOA(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::SOA());
+    return (RRType_createStatic(RRType::SOA()));
 }
 
 static PyObject*
 RRType_NSEC3(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::NSEC3());
+    return (RRType_createStatic(RRType::NSEC3()));
 }
 
 static PyObject*
 RRType_IXFR(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::IXFR());
+    return (RRType_createStatic(RRType::IXFR()));
 }
 
 static PyObject*
 RRType_AXFR(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::AXFR());
+    return (RRType_createStatic(RRType::AXFR()));
 }
 
 static PyObject*
 RRType_ANY(s_RRType *self UNUSED_PARAM) {
-    return RRType_createStatic(RRType::ANY());
+    return (RRType_createStatic(RRType::ANY()));
 }
 
 
@@ -453,11 +452,11 @@ initModulePart_RRType(PyObject* mod) {
     // then add it to the module. This is not just a check! (leaving
     // this out results in segmentation faults)
     if (PyType_Ready(&rrtype_type) < 0) {
-        return false;
+        return (false);
     }
     Py_INCREF(&rrtype_type);
     PyModule_AddObject(mod, "RRType",
                        reinterpret_cast<PyObject*>(&rrtype_type));
     
-    return true;
+    return (true);
 }