summaryrefslogtreecommitdiff
path: root/python/rpmfi-py.c
diff options
context:
space:
mode:
Diffstat (limited to 'python/rpmfi-py.c')
-rw-r--r--python/rpmfi-py.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c
index a43fee323..7dcf25d0e 100644
--- a/python/rpmfi-py.c
+++ b/python/rpmfi-py.c
@@ -288,26 +288,20 @@ static PyMappingMethods rpmfi_as_mapping = {
static int rpmfi_init(rpmfiObject * s, PyObject *args, PyObject *kwds)
{
- s->active = 0;
- return 0;
-}
-
-static PyObject * rpmfi_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
-{
- PyObject * to = NULL;
+ PyObject * to = NULL; /* unused */
Header h = NULL;
- rpmfi fi = NULL;
- rpmTagVal tagN = RPMTAG_BASENAMES;
int flags = 0;
char * kwlist[] = {"header", "tag", "flags", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&|Oi:rpmfi_init", kwlist,
hdrFromPyObject, &h, &to, &flags))
- return NULL;
+ return -1;
- fi = rpmfiNew(NULL, h, tagN, flags);
+ rpmfiFree(s->fi);
+ s->fi = rpmfiNew(NULL, h, RPMTAG_BASENAMES, flags);
+ s->active = 0;
- return rpmfi_Wrap(subtype, fi);
+ return 0;
}
static char rpmfi_doc[] =
@@ -352,18 +346,11 @@ PyTypeObject rpmfi_Type = {
0, /* tp_dictoffset */
(initproc) rpmfi_init, /* tp_init */
0, /* tp_alloc */
- (newfunc) rpmfi_new, /* tp_new */
+ PyType_GenericNew, /* tp_new */
0, /* tp_free */
0, /* tp_is_gc */
};
-/* ---------- */
-
-rpmfi fiFromFi(rpmfiObject * s)
-{
- return s->fi;
-}
-
PyObject * rpmfi_Wrap(PyTypeObject *subtype, rpmfi fi)
{
rpmfiObject *s = (rpmfiObject *)subtype->tp_alloc(subtype, 0);