Browse Source

app_python: fix compiler warnings
- patch provided by "Konstantin M <[email protected]>"

Konstantin M 12 years ago
parent
commit
6a45c8eba3

+ 2 - 2
modules/app_python/python_iface.c

@@ -20,13 +20,13 @@
  *
  *
 */
 */
 
 
+#include <Python.h>
+
 #include "../../action.h"
 #include "../../action.h"
 #include "../../dprint.h"
 #include "../../dprint.h"
 #include "../../route_struct.h"
 #include "../../route_struct.h"
 #include "python_exec.h"
 #include "python_exec.h"
 
 
-#include <Python.h>
-
 /* Return the number of arguments of the application command line */
 /* Return the number of arguments of the application command line */
 static PyObject*
 static PyObject*
 router_LM_ERR(PyObject *self, PyObject *args)
 router_LM_ERR(PyObject *self, PyObject *args)

+ 3 - 3
modules/app_python/python_mod.c

@@ -20,6 +20,9 @@
  *
  *
 */
 */
 
 
+#include <Python.h>
+#include <libgen.h>
+
 #include "../../str.h"
 #include "../../str.h"
 #include "../../sr_module.h"
 #include "../../sr_module.h"
 
 
@@ -28,9 +31,6 @@
 #include "python_msgobj.h"
 #include "python_msgobj.h"
 #include "python_support.h"
 #include "python_support.h"
 
 
-#include <Python.h>
-#include <libgen.h>
-
 MODULE_VERSION
 MODULE_VERSION
 
 
 static int mod_init(void);
 static int mod_init(void);

+ 3 - 6
modules/app_python/python_msgobj.c

@@ -20,19 +20,16 @@
  *
  *
 */
 */
 
 
+#include <Python.h>
+
 #include "../../action.h"
 #include "../../action.h"
 #include "../../mem/mem.h"
 #include "../../mem/mem.h"
 #include "../../sr_module.h"
 #include "../../sr_module.h"
 #include "../../dset.h"
 #include "../../dset.h"
 #include "../../parser/msg_parser.h"
 #include "../../parser/msg_parser.h"
 
 
-#include <Python.h>
 #include "structmember.h"
 #include "structmember.h"
 
 
-#ifndef Py_TYPE
-#define Py_TYPE(ob)               (((PyObject*)(ob))->ob_type)
-#endif
-
 typedef struct {
 typedef struct {
     PyObject_HEAD
     PyObject_HEAD
     struct sip_msg *msg;
     struct sip_msg *msg;
@@ -526,7 +523,7 @@ static PyTypeObject MSGtype = {
 int
 int
 python_msgobj_init(void)
 python_msgobj_init(void)
 {
 {
-    Py_TYPE((void*)(&MSGtype)) = &PyType_Type;
+    MSGtype.ob_type = &PyType_Type;
     if (PyType_Ready(&MSGtype) < 0)
     if (PyType_Ready(&MSGtype) < 0)
         return -1;
         return -1;
     return 0;
     return 0;

+ 3 - 3
modules/app_python/python_support.c

@@ -20,12 +20,12 @@
  *
  *
 */
 */
 
 
+#include <Python.h>
+#include <stdio.h>
+
 #include "../../dprint.h"
 #include "../../dprint.h"
 #include "python_mod.h"
 #include "python_mod.h"
 
 
-#include <stdio.h>
-#include <Python.h>
-
 void
 void
 python_handle_exception(const char *fname)
 python_handle_exception(const char *fname)
 {
 {