Simplify dsFromHeader()
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 22 Sep 2009 16:42:53 +0000 (19:42 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 22 Sep 2009 16:42:53 +0000 (19:42 +0300)
- just call the ds object, no need to manually redo all this stuff

python/rpmds-py.c

index 125b3d2..a9df231 100644 (file)
@@ -610,21 +610,8 @@ rpmds_Single(PyObject * s, PyObject * args, PyObject * kwds)
 rpmdsObject *
 hdr_dsFromHeader(PyObject * s, PyObject * args, PyObject * kwds)
 {
-    hdrObject * ho = (hdrObject *)s;
-    PyObject * to = NULL;
-    rpmTag tagN = RPMTAG_REQUIRENAME;
-    rpmsenseFlags flags = 0;
-    char * kwlist[] = {"to", "flags", NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oi:dsFromHeader", kwlist,
-           &to, &flags))
-       return NULL;
-
-    if (to != NULL) {
-       tagN = tagNumFromPyObject(to);
-       if (tagN == RPMTAG_NOT_FOUND) return NULL;
-    }
-    return rpmds_Wrap( rpmdsNew(hdrGetHeader(ho), tagN, 0) );
+    return PyObject_Call((PyObject *) &rpmds_Type,
+                        Py_BuildValue("(O)", s), kwds);
 }
 
 rpmdsObject *