Browse Source

[1258] a small refactoring: avoid using reinterpret_cast for Message_fromWire.

JINMEI Tatuya 13 years ago
parent
commit
938f4e9ba1
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/lib/dns/python/message_python.cc

+ 4 - 3
src/lib/dns/python/message_python.cc

@@ -75,7 +75,7 @@ PyObject* Message_makeResponse(s_Message* self);
 PyObject* Message_toText(s_Message* self);
 PyObject* Message_str(PyObject* self);
 PyObject* Message_toWire(s_Message* self, PyObject* args);
-PyObject* Message_fromWire(s_Message* self, PyObject* args);
+PyObject* Message_fromWire(PyObject* const pyself, PyObject* args);
 
 // This list contains the actual set of functions we have in
 // python. Each entry has
@@ -157,7 +157,7 @@ PyMethodDef Message_methods[] = {
       "If the given message is not in RENDER mode, an "
       "InvalidMessageOperation is raised.\n"
        },
-    { "from_wire", reinterpret_cast<PyCFunction>(Message_fromWire), METH_VARARGS,
+    { "from_wire", Message_fromWire, METH_VARARGS,
       "Parses the given wire format to a Message object.\n"
       "The first argument is a Message to parse the data into.\n"
       "The second argument must implement the buffer interface.\n"
@@ -646,7 +646,8 @@ Message_toWire(s_Message* self, PyObject* args) {
 }
 
 PyObject*
-Message_fromWire(s_Message* self, PyObject* args) {
+Message_fromWire(PyObject* const pyself, PyObject* args) {
+    s_Message* self = static_cast<s_Message*>(pyself);
     const char* b;
     Py_ssize_t len;
     Message::ParseOptions options = Message::PARSE_DEFAULT;