Add tp_{init,alloc,new,free} methods to rpmts.
Use PyObject_{New,Del} consistently throughout. CVS patchset: 5931 CVS date: 2002/12/10 19:46:03
This commit is contained in:
parent
d412f8be53
commit
fe6043016c
|
@ -8,6 +8,8 @@ PYVER= @WITH_PYTHON_VERSION@
|
|||
|
||||
SUBDIRS = rpmdb test
|
||||
|
||||
EXTRA_DIST = rpmdebug-py.c
|
||||
|
||||
INCLUDES = -I. \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_srcdir)/rpmdb \
|
||||
|
|
|
@ -387,7 +387,7 @@ static void hdr_dealloc(hdrObject * s)
|
|||
s->md5list = _free(s->md5list);
|
||||
s->fileList = _free(s->fileList);
|
||||
s->linkList = _free(s->linkList);
|
||||
PyMem_DEL(s);
|
||||
PyObject_Del(s);
|
||||
}
|
||||
|
||||
/** \ingroup python
|
||||
|
@ -632,7 +632,7 @@ PyTypeObject hdr_Type = {
|
|||
|
||||
hdrObject * hdr_Wrap(Header h)
|
||||
{
|
||||
hdrObject * hdr = PyObject_NEW(hdrObject, &hdr_Type);
|
||||
hdrObject * hdr = PyObject_New(hdrObject, &hdr_Type);
|
||||
hdr->h = headerLink(h);
|
||||
hdr->fileList = hdr->linkList = hdr->md5list = NULL;
|
||||
hdr->uids = hdr->gids = hdr->mtimes = hdr->fileSizes = NULL;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#define PY_POPT_VERSION "0.2"
|
||||
|
||||
static const char *rcs_id = "$Id: poptmodule.c,v 1.7 2002/06/05 20:28:03 jbj Exp $";
|
||||
static const char *rcs_id = "$Id: poptmodule.c,v 1.8 2002/12/10 19:46:03 jbj Exp $";
|
||||
|
||||
static char *module_doc = "Python bindings for the popt library\n\
|
||||
\n\
|
||||
|
@ -329,7 +329,7 @@ static void ctxDealloc(poptContextObject *self, PyObject *args)
|
|||
self->options = NULL;
|
||||
}
|
||||
poptFreeContext(self->ctx);
|
||||
PyMem_DEL(self);
|
||||
PyObject_Del(self);
|
||||
}
|
||||
|
||||
static PyTypeObject poptContextType = {
|
||||
|
@ -598,7 +598,7 @@ static PyObject * getContext(PyObject *self, PyObject *args)
|
|||
/* Presumably they've set the exception at a previous level */
|
||||
return NULL;
|
||||
/* Parse argv */
|
||||
c = PyObject_NEW(poptContextObject, &poptContextType);
|
||||
c = PyObject_New(poptContextObject, &poptContextType);
|
||||
c->options = opts;
|
||||
c->optionsNo = count;
|
||||
c->opt = -1;
|
||||
|
|
|
@ -118,7 +118,7 @@ rpmal_dealloc(rpmalObject * s)
|
|||
{
|
||||
if (s) {
|
||||
s->al = rpmalFree(s->al);
|
||||
PyMem_DEL(s);
|
||||
PyObject_Del(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ PyTypeObject rpmal_Type = {
|
|||
rpmalObject *
|
||||
rpmal_Wrap(rpmal al)
|
||||
{
|
||||
rpmalObject *s = PyObject_NEW(rpmalObject, &rpmal_Type);
|
||||
rpmalObject *s = PyObject_New(rpmalObject, &rpmal_Type);
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
s->al = al;
|
||||
|
|
|
@ -12,26 +12,7 @@
|
|||
|
||||
#include "rpmbc-py.h"
|
||||
|
||||
#if Py_TPFLAGS_HAVE_ITER /* XXX backport to python-1.5.2 */
|
||||
/*@unchecked@*/
|
||||
extern PyTypeObject PyCode_Type;
|
||||
/*@unchecked@*/
|
||||
extern PyTypeObject PyDictIter_Type;
|
||||
/*@unchecked@*/
|
||||
extern PyTypeObject PyFrame_Type;
|
||||
|
||||
#include <rpmcli.h> /* XXX debug only */
|
||||
|
||||
#include "header-py.h" /* XXX debug only */
|
||||
#include "rpmal-py.h" /* XXX debug only */
|
||||
#include "rpmds-py.h" /* XXX debug only */
|
||||
#include "rpmfd-py.h" /* XXX debug only */
|
||||
#include "rpmfi-py.h" /* XXX debug only */
|
||||
#include "rpmmi-py.h" /* XXX debug only */
|
||||
#include "rpmrc-py.h" /* XXX debug only */
|
||||
#include "rpmte-py.h" /* XXX debug only */
|
||||
#include "rpmts-py.h" /* XXX debug only */
|
||||
#endif
|
||||
#include "rpmdebug-py.c"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
|
@ -40,58 +21,6 @@ static int _bc_debug = 1;
|
|||
|
||||
#define is_rpmbc(o) ((o)->ob_type == &rpmbc_Type)
|
||||
|
||||
/**
|
||||
*/
|
||||
static const char * lbl(void * s)
|
||||
/*@*/
|
||||
{
|
||||
PyObject * o = s;
|
||||
|
||||
if (o == NULL) return "null";
|
||||
|
||||
if (o->ob_type == &PyType_Type) return o->ob_type->tp_name;
|
||||
|
||||
if (o->ob_type == &PyBuffer_Type) return "Buffer";
|
||||
if (o->ob_type == &PyCFunction_Type) return "CFunction";
|
||||
if (o->ob_type == &PyCObject_Type) return "CObject";
|
||||
if (o->ob_type == &PyCell_Type) return "Cell";
|
||||
if (o->ob_type == &PyClass_Type) return "Class";
|
||||
if (o->ob_type == &PyCode_Type) return "Code";
|
||||
if (o->ob_type == &PyComplex_Type) return "Complex";
|
||||
if (o->ob_type == &PyDict_Type) return "Dict";
|
||||
if (o->ob_type == &PyDictIter_Type) return "DictIter";
|
||||
if (o->ob_type == &PyFile_Type) return "File";
|
||||
if (o->ob_type == &PyFloat_Type) return "Float";
|
||||
if (o->ob_type == &PyFrame_Type) return "Frame";
|
||||
if (o->ob_type == &PyFunction_Type) return "Function";
|
||||
if (o->ob_type == &PyInstance_Type) return "Instance";
|
||||
if (o->ob_type == &PyInt_Type) return "Int";
|
||||
if (o->ob_type == &PyList_Type) return "List";
|
||||
if (o->ob_type == &PyLong_Type) return "Long";
|
||||
if (o->ob_type == &PyMethod_Type) return "Method";
|
||||
if (o->ob_type == &PyModule_Type) return "Module";
|
||||
if (o->ob_type == &PyRange_Type) return "Range";
|
||||
if (o->ob_type == &PySeqIter_Type) return "SeqIter";
|
||||
if (o->ob_type == &PySlice_Type) return "Slice";
|
||||
if (o->ob_type == &PyString_Type) return "String";
|
||||
if (o->ob_type == &PyTuple_Type) return "Tuple";
|
||||
if (o->ob_type == &PyType_Type) return "Type";
|
||||
if (o->ob_type == &PyUnicode_Type) return "Unicode";
|
||||
|
||||
if (o->ob_type == &hdr_Type) return "hdr";
|
||||
if (o->ob_type == &rpmal_Type) return "rpmal";
|
||||
if (o->ob_type == &rpmbc_Type) return "rpmbc";
|
||||
if (o->ob_type == &rpmds_Type) return "rpmds";
|
||||
if (o->ob_type == &rpmfd_Type) return "rpmfd";
|
||||
if (o->ob_type == &rpmfi_Type) return "rpmfi";
|
||||
if (o->ob_type == &rpmmi_Type) return "rpmmi";
|
||||
if (o->ob_type == &rpmrc_Type) return "rpmrc";
|
||||
if (o->ob_type == &rpmte_Type) return "rpmte";
|
||||
if (o->ob_type == &rpmts_Type) return "rpmts";
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
/* ---------- */
|
||||
|
||||
static void
|
||||
|
@ -102,7 +31,7 @@ if (_bc_debug < 0)
|
|||
fprintf(stderr, "*** rpmbc_dealloc(%p)\n", s);
|
||||
|
||||
mp32nfree(&s->n);
|
||||
PyObject_DEL(s);
|
||||
PyObject_Del(s);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -195,7 +124,7 @@ static void rpmbc_free(rpmbcObject * s)
|
|||
if (_bc_debug)
|
||||
fprintf(stderr, "*** rpmbc_free(%p[%s])\n", s, lbl(s));
|
||||
mp32nfree(&s->n);
|
||||
_PyObject_GC_Del((PyObject *)s);
|
||||
PyObject_Del(s);
|
||||
}
|
||||
|
||||
/** \ingroup python
|
||||
|
@ -216,7 +145,8 @@ rpmbc_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
|
|||
{
|
||||
PyObject * ns = (PyObject *) PyObject_New(rpmbcObject, &rpmbc_Type);
|
||||
|
||||
mp32nzero(&((rpmbcObject *)ns)->n);
|
||||
if (ns != NULL)
|
||||
mp32nzero(&((rpmbcObject *)ns)->n);
|
||||
|
||||
if (_bc_debug)
|
||||
fprintf(stderr, "*** rpmbc_new(%p[%s],%p[%s],%p[%s]) ret %p[%s]\n", subtype, lbl(subtype), args, lbl(args), kwds, lbl(kwds), ns, lbl(ns));
|
||||
|
|
|
@ -208,7 +208,7 @@ static void rpmdb_dealloc(rpmdbObject * s)
|
|||
{
|
||||
if (s->db)
|
||||
rpmdbClose(s->db);
|
||||
PyMem_DEL(s);
|
||||
PyObject_Del(s);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -290,7 +290,7 @@ rpmdbObject * rpmOpenDB(/*@unused@*/ PyObject * self, PyObject * args) {
|
|||
|
||||
if (!PyArg_ParseTuple(args, "|is", &forWrite, &root)) return NULL;
|
||||
|
||||
o = PyObject_NEW(rpmdbObject, &rpmdb_Type);
|
||||
o = PyObject_New(rpmdbObject, &rpmdb_Type);
|
||||
o->db = NULL;
|
||||
|
||||
if (rpmdbOpen(root, &o->db, forWrite ? O_RDWR | O_CREAT: O_RDONLY, 0644)) {
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
|
||||
/*@unchecked@*/
|
||||
extern PyTypeObject PyCode_Type;
|
||||
/*@unchecked@*/
|
||||
extern PyTypeObject PyDictIter_Type;
|
||||
/*@unchecked@*/
|
||||
extern PyTypeObject PyFrame_Type;
|
||||
|
||||
#include "rpmbc-py.h" /* XXX debug only */
|
||||
#include <rpmcli.h> /* XXX debug only */
|
||||
|
||||
#include "header-py.h" /* XXX debug only */
|
||||
#include "rpmal-py.h" /* XXX debug only */
|
||||
#include "rpmds-py.h" /* XXX debug only */
|
||||
#include "rpmfd-py.h" /* XXX debug only */
|
||||
#include "rpmfi-py.h" /* XXX debug only */
|
||||
#include "rpmmi-py.h" /* XXX debug only */
|
||||
#include "rpmrc-py.h" /* XXX debug only */
|
||||
#include "rpmte-py.h" /* XXX debug only */
|
||||
#include "rpmts-py.h" /* XXX debug only */
|
||||
|
||||
/**
|
||||
*/
|
||||
static const char * lbl(void * s)
|
||||
/*@*/
|
||||
{
|
||||
PyObject * o = s;
|
||||
|
||||
if (o == NULL) return "null";
|
||||
|
||||
if (o->ob_type == &PyType_Type) return o->ob_type->tp_name;
|
||||
|
||||
if (o->ob_type == &PyBuffer_Type) return "Buffer";
|
||||
if (o->ob_type == &PyCFunction_Type) return "CFunction";
|
||||
if (o->ob_type == &PyCObject_Type) return "CObject";
|
||||
if (o->ob_type == &PyCell_Type) return "Cell";
|
||||
if (o->ob_type == &PyClass_Type) return "Class";
|
||||
if (o->ob_type == &PyCode_Type) return "Code";
|
||||
if (o->ob_type == &PyComplex_Type) return "Complex";
|
||||
if (o->ob_type == &PyDict_Type) return "Dict";
|
||||
if (o->ob_type == &PyDictIter_Type) return "DictIter";
|
||||
if (o->ob_type == &PyFile_Type) return "File";
|
||||
if (o->ob_type == &PyFloat_Type) return "Float";
|
||||
if (o->ob_type == &PyFrame_Type) return "Frame";
|
||||
if (o->ob_type == &PyFunction_Type) return "Function";
|
||||
if (o->ob_type == &PyInstance_Type) return "Instance";
|
||||
if (o->ob_type == &PyInt_Type) return "Int";
|
||||
if (o->ob_type == &PyList_Type) return "List";
|
||||
if (o->ob_type == &PyLong_Type) return "Long";
|
||||
if (o->ob_type == &PyMethod_Type) return "Method";
|
||||
if (o->ob_type == &PyModule_Type) return "Module";
|
||||
if (o->ob_type == &PyRange_Type) return "Range";
|
||||
if (o->ob_type == &PySeqIter_Type) return "SeqIter";
|
||||
if (o->ob_type == &PySlice_Type) return "Slice";
|
||||
if (o->ob_type == &PyString_Type) return "String";
|
||||
if (o->ob_type == &PyTuple_Type) return "Tuple";
|
||||
if (o->ob_type == &PyType_Type) return "Type";
|
||||
if (o->ob_type == &PyUnicode_Type) return "Unicode";
|
||||
|
||||
if (o->ob_type == &hdr_Type) return "hdr";
|
||||
if (o->ob_type == &rpmal_Type) return "rpmal";
|
||||
if (o->ob_type == &rpmbc_Type) return "rpmbc";
|
||||
if (o->ob_type == &rpmds_Type) return "rpmds";
|
||||
if (o->ob_type == &rpmfd_Type) return "rpmfd";
|
||||
if (o->ob_type == &rpmfi_Type) return "rpmfi";
|
||||
if (o->ob_type == &rpmmi_Type) return "rpmmi";
|
||||
if (o->ob_type == &rpmrc_Type) return "rpmrc";
|
||||
if (o->ob_type == &rpmte_Type) return "rpmte";
|
||||
if (o->ob_type == &rpmts_Type) return "rpmts";
|
||||
|
||||
return "Unknown";
|
||||
}
|
|
@ -235,7 +235,7 @@ rpmds_dealloc(rpmdsObject * s)
|
|||
{
|
||||
if (s) {
|
||||
s->ds = rpmdsFree(s->ds);
|
||||
PyMem_DEL(s);
|
||||
PyObject_Del(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ rpmds dsFromDs(rpmdsObject * s)
|
|||
rpmdsObject *
|
||||
rpmds_Wrap(rpmds ds)
|
||||
{
|
||||
rpmdsObject * s = PyObject_NEW(rpmdsObject, &rpmds_Type);
|
||||
rpmdsObject * s = PyObject_New(rpmdsObject, &rpmds_Type);
|
||||
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
|
|
|
@ -227,7 +227,7 @@ PyTypeObject rpmfd_Type = {
|
|||
|
||||
rpmfdObject * rpmfd_Wrap(FD_t fd)
|
||||
{
|
||||
rpmfdObject *s = PyObject_NEW(rpmfdObject, &rpmfd_Type);
|
||||
rpmfdObject *s = PyObject_New(rpmfdObject, &rpmfd_Type);
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
s->fd = fd;
|
||||
|
|
|
@ -370,7 +370,7 @@ rpmfi_dealloc(/*@only@*/ /*@null@*/ rpmfiObject * s)
|
|||
{
|
||||
if (s) {
|
||||
s->fi = rpmfiFree(s->fi);
|
||||
PyMem_DEL(s);
|
||||
PyObject_Del(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ rpmfi fiFromFi(rpmfiObject * s)
|
|||
rpmfiObject *
|
||||
rpmfi_Wrap(rpmfi fi)
|
||||
{
|
||||
rpmfiObject *s = PyObject_NEW(rpmfiObject, &rpmfi_Type);
|
||||
rpmfiObject *s = PyObject_New(rpmfiObject, &rpmfi_Type);
|
||||
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
|
|
|
@ -208,7 +208,7 @@ static void rpmmi_dealloc(/*@only@*/ /*@null@*/ rpmmiObject * s)
|
|||
{
|
||||
if (s) {
|
||||
if (s->mi) s->mi = rpmdbFreeIterator(s->mi);
|
||||
PyMem_DEL(s);
|
||||
PyObject_Del(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ PyTypeObject rpmmi_Type = {
|
|||
|
||||
rpmmiObject * rpmmi_Wrap(rpmdbMatchIterator mi)
|
||||
{
|
||||
rpmmiObject * mio = (rpmmiObject *) PyObject_NEW(rpmmiObject, &rpmmi_Type);
|
||||
rpmmiObject * mio = (rpmmiObject *) PyObject_New(rpmmiObject, &rpmmi_Type);
|
||||
|
||||
if (mio == NULL) {
|
||||
PyErr_SetString(pyrpmError, "out of memory creating rpmmiObject");
|
||||
|
|
|
@ -12,30 +12,16 @@
|
|||
|
||||
#include "structmember.h"
|
||||
|
||||
/*@unchecked@*/
|
||||
extern PyTypeObject PyDictIter_Type;
|
||||
#include "rpmdebug-py.c"
|
||||
|
||||
#include <rpmcli.h>
|
||||
|
||||
#include "rpmrc-py.h"
|
||||
|
||||
#if Py_TPFLAGS_HAVE_ITER /* XXX backport to python-1.5.2 */
|
||||
#include "header-py.h" /* XXX debug only */
|
||||
#include "rpmal-py.h" /* XXX debug only */
|
||||
#include "rpmds-py.h" /* XXX debug only */
|
||||
#include "rpmfd-py.h" /* XXX debug only */
|
||||
#include "rpmfi-py.h" /* XXX debug only */
|
||||
#include "rpmmi-py.h" /* XXX debug only */
|
||||
#include "rpmte-py.h" /* XXX debug only */
|
||||
#include "rpmts-py.h" /* XXX debug only */
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#if Py_TPFLAGS_HAVE_ITER /* XXX backport to python-1.5.2 */
|
||||
/*@unchecked@*/
|
||||
static int _rc_debug = 0;
|
||||
#endif
|
||||
|
||||
/** \ingroup python
|
||||
* \class Rpmrc
|
||||
|
@ -78,46 +64,6 @@ PyObject * rpmrc_DelMacro(/*@unused@*/ PyObject * self, PyObject * args)
|
|||
}
|
||||
|
||||
#if Py_TPFLAGS_HAVE_ITER /* XXX backport to python-1.5.2 */
|
||||
/**
|
||||
*/
|
||||
static const char * lbl(void * s)
|
||||
/*@*/
|
||||
{
|
||||
PyObject * o = s;
|
||||
|
||||
if (o == NULL) return "null";
|
||||
|
||||
if (o->ob_type == &PyType_Type) return o->ob_type->tp_name;
|
||||
|
||||
if (o->ob_type == &PyClass_Type) return "Class";
|
||||
if (o->ob_type == &PyComplex_Type) return "Complex";
|
||||
if (o->ob_type == &PyDict_Type) return "Dict";
|
||||
if (o->ob_type == &PyDictIter_Type) return "DictIter";
|
||||
if (o->ob_type == &PyFile_Type) return "File";
|
||||
if (o->ob_type == &PyFloat_Type) return "Float";
|
||||
if (o->ob_type == &PyFunction_Type) return "Function";
|
||||
if (o->ob_type == &PyInt_Type) return "Int";
|
||||
if (o->ob_type == &PyList_Type) return "List";
|
||||
if (o->ob_type == &PyLong_Type) return "Long";
|
||||
if (o->ob_type == &PyMethod_Type) return "Method";
|
||||
if (o->ob_type == &PyModule_Type) return "Module";
|
||||
if (o->ob_type == &PyString_Type) return "String";
|
||||
if (o->ob_type == &PyTuple_Type) return "Tuple";
|
||||
if (o->ob_type == &PyType_Type) return "Type";
|
||||
if (o->ob_type == &PyUnicode_Type) return "Unicode";
|
||||
|
||||
if (o->ob_type == &hdr_Type) return "hdr";
|
||||
if (o->ob_type == &rpmal_Type) return "rpmal";
|
||||
if (o->ob_type == &rpmds_Type) return "rpmds";
|
||||
if (o->ob_type == &rpmfd_Type) return "rpmfd";
|
||||
if (o->ob_type == &rpmfi_Type) return "rpmfi";
|
||||
if (o->ob_type == &rpmmi_Type) return "rpmmi";
|
||||
if (o->ob_type == &rpmrc_Type) return "rpmrc";
|
||||
if (o->ob_type == &rpmte_Type) return "rpmte";
|
||||
if (o->ob_type == &rpmts_Type) return "rpmts";
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -421,7 +421,7 @@ PyTypeObject rpmte_Type = {
|
|||
|
||||
rpmteObject * rpmte_Wrap(rpmte te)
|
||||
{
|
||||
rpmteObject *s = PyObject_NEW(rpmteObject, &rpmte_Type);
|
||||
rpmteObject *s = PyObject_New(rpmteObject, &rpmte_Type);
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
s->te = te;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "debug.h"
|
||||
|
||||
/*@unchecked@*/
|
||||
static int _rpmts_debug = 0;
|
||||
|
||||
/*@access alKey @*/
|
||||
|
@ -1329,7 +1330,7 @@ fprintf(stderr, "%p -- ts %p db %p\n", trans, trans->ts, trans->ts->rdb);
|
|||
/* this will free the keyList, and decrement the ref count of all
|
||||
the items on the list as well :-) */
|
||||
Py_DECREF(trans->keyList);
|
||||
PyMem_DEL(o);
|
||||
PyObject_Del(o);
|
||||
}
|
||||
|
||||
/** \ingroup python
|
||||
|
@ -1364,6 +1365,81 @@ static int rpmts_setattr(rpmtsObject * o, char * name, PyObject * val)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** \ingroup python
|
||||
*/
|
||||
static int rpmts_init(rpmtsObject * s, PyObject *args, PyObject *kwds)
|
||||
/*@*/
|
||||
{
|
||||
char * rootDir = "/";
|
||||
int vsflags = rpmExpandNumeric("%{?_vsflags_up2date}");
|
||||
|
||||
if (_rpmts_debug < 0)
|
||||
fprintf(stderr, "*** rpmts_init(%p,%p,%p)\n", s, args, kwds);
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|si:rpmts_init", &rootDir, &vsflags))
|
||||
return -1;
|
||||
|
||||
s->ts = rpmtsCreate();
|
||||
(void) rpmtsSetRootDir(s->ts, rootDir);
|
||||
(void) rpmtsSetVSFlags(s->ts, vsflags);
|
||||
s->keyList = PyList_New(0);
|
||||
s->scriptFd = NULL;
|
||||
s->tsi = NULL;
|
||||
s->tsiFilter = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \ingroup python
|
||||
*/
|
||||
static void rpmts_free(rpmtsObject * s)
|
||||
/*@*/
|
||||
{
|
||||
if (_rpmts_debug)
|
||||
fprintf(stderr, "%p -- ts %p db %p\n", s, s->ts, s->ts->rdb);
|
||||
rpmtsFree(s->ts);
|
||||
|
||||
if (s->scriptFd)
|
||||
Fclose(s->scriptFd);
|
||||
|
||||
/* this will free the keyList, and decrement the ref count of all
|
||||
the items on the list as well :-) */
|
||||
Py_DECREF(s->keyList);
|
||||
|
||||
_PyObject_GC_Del((PyObject *)s);
|
||||
}
|
||||
|
||||
/** \ingroup python
|
||||
*/
|
||||
static PyObject * rpmts_alloc(PyTypeObject * subtype, int nitems)
|
||||
/*@*/
|
||||
{
|
||||
PyObject * s = PyType_GenericAlloc(subtype, nitems);
|
||||
|
||||
if (_rpmts_debug < 0)
|
||||
fprintf(stderr, "*** rpmts_alloc(%p,%d) ret %p\n", subtype, nitems, s);
|
||||
return s;
|
||||
}
|
||||
|
||||
/** \ingroup python
|
||||
*/
|
||||
static PyObject * rpmts_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
|
||||
/*@*/
|
||||
{
|
||||
rpmtsObject * s = (void *) PyObject_New(rpmtsObject, subtype);
|
||||
|
||||
/* Perform additional initialization. */
|
||||
if (rpmts_init(s, args, kwds) < 0) {
|
||||
rpmts_free(s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (_rpmts_debug)
|
||||
fprintf(stderr, "%p ++ ts %p db %p\n", s, s->ts, s->ts->rdb);
|
||||
|
||||
return (PyObject *)s;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
/*@unchecked@*/ /*@observer@*/
|
||||
|
@ -1411,10 +1487,10 @@ PyTypeObject rpmts_Type = {
|
|||
0, /* tp_descr_get */
|
||||
0, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
0, /* tp_new */
|
||||
0, /* tp_free */
|
||||
(initproc) rpmts_init, /* tp_init */
|
||||
(allocfunc) rpmts_alloc, /* tp_alloc */
|
||||
(newfunc) rpmts_new, /* tp_new */
|
||||
(destructor) rpmts_free, /* tp_free */
|
||||
0, /* tp_is_gc */
|
||||
#endif
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue