diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-11-26 13:10:35 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-11-26 13:10:35 +0000 |
| commit | e5f1c45c07b1ff43c0113a51128f60bd3e348aa4 (patch) | |
| tree | 8b00c1d92a9c6cd835f1ae3dfe9e75bc8e01e91c /lib/service | |
| parent | 6dcb75c26bbfec04b381bb99d75404f9fe50635d (diff) | |
| download | enigma2-e5f1c45c07b1ff43c0113a51128f60bd3e348aa4.tar.gz enigma2-e5f1c45c07b1ff43c0113a51128f60bd3e348aa4.zip | |
more python refcount debugging stuff
Diffstat (limited to 'lib/service')
| -rw-r--r-- | lib/service/iservice.h | 32 | ||||
| -rw-r--r-- | lib/service/servicedvb.cpp | 8 | ||||
| -rw-r--r-- | lib/service/servicefs.cpp | 4 |
3 files changed, 38 insertions, 6 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h index 25935b2f..0d11dd7e 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -184,6 +184,22 @@ SWIG_ALLOW_OUTPUT_SIMPLE(eServiceReference); extern PyObject *New_eServiceReference(const eServiceReference &ref); // defined in enigma_python.i +#ifndef SWIG +#ifdef PYTHON_REFCOUNT_DEBUG +inline ePyObject Impl_New_eServiceReference(const char* file, int line, const eServiceReference &ref) +{ + return ePyObject(New_eServiceReference(ref), file, line); +} +#define NEW_eServiceReference(ref) Impl_New_eServiceReference(__FILE__, __LINE__, ref) +#else +inline ePyObject Impl_New_eServiceReference(const eServiceReference &ref) +{ + return New_eServiceReference(ref); +} +#define NEW_eServiceReference(ref) Impl_New_eServiceReference(ref) +#endif +#endif // SWIG + typedef long long pts_t; /* the reason we have the servicereference as additional argument is @@ -582,6 +598,22 @@ inline PyObject *PyFrom(ePtr<iRecordableService> &c) return New_iRecordableServicePtr(c); } +#ifndef SWIG +#ifdef PYTHON_REFCOUNT_DEBUG +inline ePyObject Impl_New_iRecordableServicePtr(const char* file, int line, const ePtr<iRecordableService> &ptr) +{ + return ePyObject(New_iRecordableServicePtr(ptr), file, line); +} +#define NEW_iRecordableServicePtr(ptr) Impl_New_iRecordableServicePtr(__FILE__, __LINE__, ptr) +#else +inline ePyObject Impl_New_iRecordableServicePtr(const ePtr<iRecordableService> &ptr) +{ + return New_iRecordableServicePtr(ptr); +} +#define NEW_iRecordableServicePtr(ptr) Impl_New_iRecordableServicePtr(ptr) +#endif +#endif // SWIG + // TEMPLATE_TYPEDEF(std::list<eServiceReference>, eServiceReferenceList); class iMutableServiceList: public iObject diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 627ccec0..871a0b26 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -428,14 +428,14 @@ PyObject *eDVBServiceList::getContent(const char* format, bool sorted) for (int cnt=0; cnt < services; ++cnt) { eServiceReference &ref=*it++; - ePyObject tuple = retcount > 1 ? PyTuple_New(retcount) : 0; + ePyObject tuple = retcount > 1 ? PyTuple_New(retcount) : ePyObject(); for (int i=0; i < retcount; ++i) { ePyObject tmp; switch(format[i]) { case 'R': // service reference (swig)object - tmp = New_eServiceReference(ref); + tmp = NEW_eServiceReference(ref); break; case 'C': // service reference compare string tmp = PyString_FromString(ref.toCompareString().c_str()); @@ -1551,7 +1551,7 @@ void eDVBServicePlay::setCutList(ePyObject list) for (i=0; i<size; ++i) { - ePyObject tuple = PyList_GetItem(list, i); + ePyObject tuple = PyList_GET_ITEM(list, i); if (!PyTuple_Check(tuple)) { eDebug("non-tuple in cutlist"); @@ -1562,7 +1562,7 @@ void eDVBServicePlay::setCutList(ePyObject list) eDebug("cutlist entries need to be a 2-tuple"); continue; } - ePyObject ppts = PyTuple_GetItem(tuple, 0), ptype = PyTuple_GetItem(tuple, 1); + ePyObject ppts = PyTuple_GET_ITEM(tuple, 0), ptype = PyTuple_GET_ITEM(tuple, 1); if (!(PyLong_Check(ppts) && PyInt_Check(ptype))) { eDebug("cutlist entries need to be (pts, type)-tuples (%d %d)", PyLong_Check(ppts), PyInt_Check(ptype)); diff --git a/lib/service/servicefs.cpp b/lib/service/servicefs.cpp index b0023212..f2772192 100644 --- a/lib/service/servicefs.cpp +++ b/lib/service/servicefs.cpp @@ -208,14 +208,14 @@ PyObject *eServiceFS::getContent(const char* format, bool sorted) for (int cnt=0; cnt < services; ++cnt) { eServiceReference &ref=*it++; - ePyObject tuple = retcount > 1 ? PyTuple_New(retcount) : 0; + ePyObject tuple = retcount > 1 ? PyTuple_New(retcount) : ePyObject(); for (int i=0; i < retcount; ++i) { ePyObject tmp; switch(format[i]) { case 'R': // service reference (swig)object - tmp = New_eServiceReference(ref); + tmp = NEW_eServiceReference(ref); break; case 'C': // service reference compare string tmp = PyString_FromString(ref.toCompareString().c_str()); |
