From 39d03aa29e19bcb01471de836c5d0793ab8d9e5c Mon Sep 17 00:00:00 2001 From: msw Date: Mon, 28 Feb 2000 20:00:31 +0000 Subject: i18nation CVS patchset: 3598 CVS date: 2000/02/28 20:00:31 --- python/rpmmodule.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/python/rpmmodule.c b/python/rpmmodule.c index c0104516e..1d79f219f 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -228,6 +228,8 @@ void initrpm(void) { const struct headerSprintfExtension * extensions = rpmHeaderFormats; struct headerSprintfExtension * ext; +/* i18ndomains = "redhat-dist"; */ + /* _rpmio_debug = -1; */ rpmReadConfigFiles(NULL, NULL); @@ -914,7 +916,7 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) { PyObject * o, * metao; char ** stringArray; int forceArray = 0; - int freeData; + int freeData = 0; char * str; struct headerSprintfExtension * ext = NULL; const struct headerSprintfExtension * extensions = rpmHeaderFormats; @@ -942,15 +944,14 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) { } if (ext) { - ext->u.tagFunction(s->h, &type, &data, &count, &freeData); - forceArray = 1; + ext->u.tagFunction(s->h, &type, (const void **) &data, &count, &freeData); } else { if (tag == -1) { PyErr_SetString(PyExc_KeyError, "unknown header tag"); return NULL; } - if (!headerGetEntry(s->h, tag, &type, &data, &count)) { + if (!rpmHeaderGetEntry(s->h, tag, &type, &data, &count)) { Py_INCREF(Py_None); return Py_None; } @@ -972,6 +973,14 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) { case RPMTAG_FILEUSERNAME: case RPMTAG_FILEGROUPNAME: forceArray = 1; + break; + case RPMTAG_SUMMARY: + case RPMTAG_GROUP: + case RPMTAG_DESCRIPTION: + freeData = 1; + break; + default: + break; } switch (type) { @@ -1045,8 +1054,11 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) { Py_DECREF(o); } o = metao; - } else - o = PyString_FromString(data); + } else { + o = PyString_FromString(data); + if (freeData) + free (data); + } break; default: -- cgit v1.2.3