Diff for /embedaddon/miniupnpc/miniupnpcmodule.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 23:16:22 version 1.1.1.2, 2013/07/22 00:36:10
Line 2 Line 2
 /* Project : miniupnp  /* Project : miniupnp
  * Author : Thomas BERNARD   * Author : Thomas BERNARD
  * website : http://miniupnp.tuxfamily.org/   * website : http://miniupnp.tuxfamily.org/
 * copyright (c) 2007-2009 Thomas Bernard * copyright (c) 2007-2012 Thomas Bernard
  * This software is subjet to the conditions detailed in the   * This software is subjet to the conditions detailed in the
  * provided LICENCE file. */   * provided LICENCE file. */
 #include <Python.h>  #include <Python.h>
Line 25 Line 25
 #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False  #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
 #endif  #endif
   
   /* for compatibility with Python < 3.0 */
   #ifndef PyVarObject_HEAD_INIT
   #define PyVarObject_HEAD_INIT(type, size) \
       PyObject_HEAD_INIT(type) size,
   #endif
   
   #ifndef Py_TYPE
   #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
   #endif
   
 typedef struct {  typedef struct {
     PyObject_HEAD      PyObject_HEAD
     /* Type-specific fields go here. */      /* Type-specific fields go here. */
Line 59  UPnPObject_dealloc(UPnPObject *self) Line 69  UPnPObject_dealloc(UPnPObject *self)
 {  {
         freeUPNPDevlist(self->devlist);          freeUPNPDevlist(self->devlist);
         FreeUPNPUrls(&self->urls);          FreeUPNPUrls(&self->urls);
        self->ob_type->tp_free((PyObject*)self);        Py_TYPE(self)->tp_free((PyObject*)self);
 }  }
   
 static PyObject *  static PyObject *
Line 72  UPnP_discover(UPnPObject *self) Line 82  UPnP_discover(UPnPObject *self)
         {          {
                 freeUPNPDevlist(self->devlist);                  freeUPNPDevlist(self->devlist);
                 self->devlist = 0;                  self->devlist = 0;
        }         }
         Py_BEGIN_ALLOW_THREADS          Py_BEGIN_ALLOW_THREADS
         self->devlist = upnpDiscover((int)self->discoverdelay/*timeout in ms*/,          self->devlist = upnpDiscover((int)self->discoverdelay/*timeout in ms*/,
                                      0/* multicast if*/,                                       0/* multicast if*/,
Line 215  Py_END_ALLOW_THREADS Line 225  Py_END_ALLOW_THREADS
 }  }
   
 /* AddPortMapping(externalPort, protocol, internalHost, internalPort, desc,  /* AddPortMapping(externalPort, protocol, internalHost, internalPort, desc,
 *                remoteHost)  *                remoteHost)
  * protocol is 'UDP' or 'TCP' */   * protocol is 'UDP' or 'TCP' */
 static PyObject *  static PyObject *
 UPnP_addportmapping(UPnPObject *self, PyObject *args)  UPnP_addportmapping(UPnPObject *self, PyObject *args)
Line 300  Py_END_ALLOW_THREADS Line 310  Py_END_ALLOW_THREADS
         }          }
 }  }
   
/* GetSpecificPortMapping(ePort, proto) /* GetSpecificPortMapping(ePort, proto)
  * proto = 'UDP' or 'TCP' */   * proto = 'UDP' or 'TCP' */
 static PyObject *  static PyObject *
 UPnP_getspecificportmapping(UPnPObject *self, PyObject *args)  UPnP_getspecificportmapping(UPnPObject *self, PyObject *args)
Line 434  static PyMethodDef UPnP_methods[] = { Line 444  static PyMethodDef UPnP_methods[] = {
 };  };
   
 static PyTypeObject UPnPType = {  static PyTypeObject UPnPType = {
    PyObject_HEAD_INIT(NULL)    PyVarObject_HEAD_INIT(NULL,
    0,                         /*ob_size*/    0)                         /*ob_size*/
     "miniupnpc.UPnP",          /*tp_name*/      "miniupnpc.UPnP",          /*tp_name*/
     sizeof(UPnPObject),        /*tp_basicsize*/      sizeof(UPnPObject),        /*tp_basicsize*/
     0,                         /*tp_itemsize*/      0,                         /*tp_itemsize*/
Line 472  static PyTypeObject UPnPType = { Line 482  static PyTypeObject UPnPType = {
     0,                         /* tp_dictoffset */      0,                         /* tp_dictoffset */
     0,/*(initproc)UPnP_init,*/      /* tp_init */      0,/*(initproc)UPnP_init,*/      /* tp_init */
     0,                         /* tp_alloc */      0,                         /* tp_alloc */
#ifndef WIN32#ifndef _WIN32
     PyType_GenericNew,/*UPnP_new,*/      /* tp_new */      PyType_GenericNew,/*UPnP_new,*/      /* tp_new */
 #else  #else
     0,      0,
Line 484  static PyMethodDef miniupnpc_methods[] = { Line 494  static PyMethodDef miniupnpc_methods[] = {
     {NULL}  /* Sentinel */      {NULL}  /* Sentinel */
 };  };
   
   #if PY_MAJOR_VERSION >= 3
   static struct PyModuleDef moduledef = {
       PyModuleDef_HEAD_INIT,
       "miniupnpc",     /* m_name */
       "miniupnpc module.",  /* m_doc */
       -1,                  /* m_size */
       miniupnpc_methods,    /* m_methods */
       NULL,                /* m_reload */
       NULL,                /* m_traverse */
       NULL,                /* m_clear */
       NULL,                /* m_free */
   };
   #endif
   
 #ifndef PyMODINIT_FUNC  /* declarations for DLL import/export */  #ifndef PyMODINIT_FUNC  /* declarations for DLL import/export */
 #define PyMODINIT_FUNC void  #define PyMODINIT_FUNC void
 #endif  #endif
   
 PyMODINIT_FUNC  PyMODINIT_FUNC
initminiupnpc(void) #if PY_MAJOR_VERSION >= 3
 PyInit_miniupnpc(void)
 #else
 initminiupnpc(void)
 #endif
 {  {
     PyObject* m;      PyObject* m;
   
#ifdef WIN32#ifdef _WIN32
     UPnPType.tp_new = PyType_GenericNew;      UPnPType.tp_new = PyType_GenericNew;
 #endif  #endif
     if (PyType_Ready(&UPnPType) < 0)      if (PyType_Ready(&UPnPType) < 0)
         return;          return;
   
   #if PY_MAJOR_VERSION >= 3
       m = PyModule_Create(&moduledef);
   #else
     m = Py_InitModule3("miniupnpc", miniupnpc_methods,      m = Py_InitModule3("miniupnpc", miniupnpc_methods,
                        "miniupnpc module.");                         "miniupnpc module.");
   #endif
   
     Py_INCREF(&UPnPType);      Py_INCREF(&UPnPType);
     PyModule_AddObject(m, "UPnP", (PyObject *)&UPnPType);      PyModule_AddObject(m, "UPnP", (PyObject *)&UPnPType);
       
   #if PY_MAJOR_VERSION >= 3
       return m;
   #endif
 }  }
   

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>