diff options
author | jbj <devnull@localhost> | 2001-03-20 15:00:07 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-03-20 15:00:07 +0000 |
commit | 7ed904da030dc4640ff9bce8458ba07cc09d830d (patch) | |
tree | 8a02840e6b33c94f8a488f2cbce0398a1495c9b2 /python | |
parent | 63890e6a4ab13e7ccafbd7643095539f832743fa (diff) | |
download | librpm-tizen-7ed904da030dc4640ff9bce8458ba07cc09d830d.tar.gz librpm-tizen-7ed904da030dc4640ff9bce8458ba07cc09d830d.tar.bz2 librpm-tizen-7ed904da030dc4640ff9bce8458ba07cc09d830d.zip |
Strip header regions during unload.
CVS patchset: 4643
CVS date: 2001/03/20 15:00:07
Diffstat (limited to 'python')
-rw-r--r-- | python/rpmmodule.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/python/rpmmodule.c b/python/rpmmodule.c index 89501bf6f..1dd736024 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -149,13 +149,25 @@ static PyObject * hdrKeyList(hdrObject * s, PyObject * args) { /** \ingroup python */ -static PyObject * hdrUnload(hdrObject * s, PyObject * args) { +static PyObject * hdrUnload(hdrObject * s, PyObject * args, PyObject *keywords) { char * buf; - int len; PyObject * rc; + int len, legacy = 0; + static char *kwlist[] = { "legacyHeader", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, keywords, "|i", kwlist, &legacy)) + return NULL; + + if (legacy) { + Header h; - len = headerSizeof(s->h, 0); - buf = headerUnload(s->h); + h = headerCopy(s->h); + len = headerSizeof(h, 0); + buf = headerUnload(h); + } else { + len = headerSizeof(s->h, 0); + buf = headerUnload(s->h); + } rc = PyString_FromStringAndSize(buf, len); free(buf); @@ -418,7 +430,7 @@ static PyObject * hdrFullFilelist(hdrObject * s, PyObject * args) { */ static struct PyMethodDef hdrMethods[] = { {"keys", (PyCFunction) hdrKeyList, 1 }, - {"unload", (PyCFunction) hdrUnload, 1 }, + {"unload", (PyCFunction) hdrUnload, METH_VARARGS|METH_KEYWORDS }, {"verifyFile", (PyCFunction) hdrVerifyFile, 1 }, {"expandFilelist", (PyCFunction) hdrExpandFilelist, 1 }, {"compressFilelist", (PyCFunction) hdrCompressFilelist, 1 }, @@ -2335,7 +2347,7 @@ void initrpm(void) { #define REGISTER_ENUM(val) \ - PyDict_SetItemString(d, #val, o=PyInt_FromLong(## val)); \ + PyDict_SetItemString(d, #val, o=PyInt_FromLong( val )); \ Py_DECREF(o); REGISTER_ENUM(RPMFILE_STATE_NORMAL); |