summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-09-24 12:52:32 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-09-24 12:52:32 +0300
commit74c1040dbc4b4977045745f924ea0774c2e3ee53 (patch)
tree7690fe76effa1db2c4a3de394a37272e14436d88 /python
parent36ada6c116e123f5b5b739e12f256201e5cc6fa1 (diff)
downloadrpm-74c1040dbc4b4977045745f924ea0774c2e3ee53.tar.gz
rpm-74c1040dbc4b4977045745f924ea0774c2e3ee53.tar.bz2
rpm-74c1040dbc4b4977045745f924ea0774c2e3ee53.zip
Call (sub)type tp_free from destructors
- more preliminaries for subtyping - remove pointless NULL checks
Diffstat (limited to 'python')
-rw-r--r--python/header-py.c2
-rw-r--r--python/rpmds-py.c6
-rw-r--r--python/rpmfi-py.c6
-rw-r--r--python/rpmmi-py.c8
-rw-r--r--python/rpmps-py.c6
-rw-r--r--python/rpmts-py.c2
-rw-r--r--python/spec-py.c8
7 files changed, 15 insertions, 23 deletions
diff --git a/python/header-py.c b/python/header-py.c
index 29a2f7e42..9bd05c010 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -402,7 +402,7 @@ static PyObject *hdr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
static void hdr_dealloc(hdrObject * s)
{
if (s->h) headerFree(s->h);
- PyObject_Del(s);
+ s->ob_type->tp_free((PyObject *)s);
}
int tagNumFromPyObject (PyObject *item, rpmTag *tagp)
diff --git a/python/rpmds-py.c b/python/rpmds-py.c
index dccd9a79e..5ac4dda09 100644
--- a/python/rpmds-py.c
+++ b/python/rpmds-py.c
@@ -379,10 +379,8 @@ The current index in ds is positioned at overlapping member upon success.\n" },
static void
rpmds_dealloc(rpmdsObject * s)
{
- if (s) {
- s->ds = rpmdsFree(s->ds);
- PyObject_Del(s);
- }
+ s->ds = rpmdsFree(s->ds);
+ s->ob_type->tp_free((PyObject *)s);
}
static int
diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c
index 9a27e0476..860e06930 100644
--- a/python/rpmfi-py.c
+++ b/python/rpmfi-py.c
@@ -257,10 +257,8 @@ static struct PyMethodDef rpmfi_methods[] = {
static void
rpmfi_dealloc(rpmfiObject * s)
{
- if (s) {
- s->fi = rpmfiFree(s->fi);
- PyObject_Del(s);
- }
+ s->fi = rpmfiFree(s->fi);
+ s->ob_type->tp_free((PyObject *)s);
}
static int
diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c
index 0fa1ab395..d6ab095a1 100644
--- a/python/rpmmi-py.c
+++ b/python/rpmmi-py.c
@@ -131,11 +131,9 @@ static struct PyMethodDef rpmmi_methods[] = {
static void rpmmi_dealloc(rpmmiObject * s)
{
- if (s) {
- s->mi = rpmdbFreeIterator(s->mi);
- Py_DECREF(s->ref);
- PyObject_Del(s);
- }
+ s->mi = rpmdbFreeIterator(s->mi);
+ Py_DECREF(s->ref);
+ s->ob_type->tp_free((PyObject *)s);
}
static char rpmmi_doc[] =
diff --git a/python/rpmps-py.c b/python/rpmps-py.c
index 82422c0d1..c9f6050fa 100644
--- a/python/rpmps-py.c
+++ b/python/rpmps-py.c
@@ -61,10 +61,8 @@ static struct PyMethodDef rpmps_methods[] = {
static void
rpmps_dealloc(rpmpsObject * s)
{
- if (s) {
- s->ps = rpmpsFree(s->ps);
- PyObject_Del(s);
- }
+ s->ps = rpmpsFree(s->ps);
+ s->ob_type->tp_free((PyObject *)s);
}
static int
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index 2ade49285..821d951a9 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -982,7 +982,7 @@ static void rpmts_dealloc(rpmtsObject * s)
/* this will free the keyList, and decrement the ref count of all
the items on the list as well :-) */
Py_DECREF(s->keyList);
- PyObject_Del((PyObject *)s);
+ s->ob_type->tp_free((PyObject *)s);
}
static PyObject * rpmts_getattro(PyObject * o, PyObject * n)
diff --git a/python/spec-py.c b/python/spec-py.c
index d4d13b313..85f2d104c 100644
--- a/python/spec-py.c
+++ b/python/spec-py.c
@@ -37,10 +37,10 @@ struct specObject_s {
static void
spec_dealloc(specObject * s)
{
- if (s->spec) {
- s->spec=freeSpec(s->spec);
- }
- PyObject_Del(s);
+ if (s->spec) {
+ s->spec=freeSpec(s->spec);
+ }
+ s->ob_type->tp_free((PyObject *)s);
}
/* XXX TODO return something sensible if spec exists but component (eg %clean)