summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authormsw <devnull@localhost>2000-02-28 20:00:31 +0000
committermsw <devnull@localhost>2000-02-28 20:00:31 +0000
commit39d03aa29e19bcb01471de836c5d0793ab8d9e5c (patch)
treef953bbf5ad4a6bc349974a4ca9114397b9a2bdb0 /python
parent19e47314eaaae3e46760207ea434448fce11ba11 (diff)
downloadrpm-39d03aa29e19bcb01471de836c5d0793ab8d9e5c.tar.gz
rpm-39d03aa29e19bcb01471de836c5d0793ab8d9e5c.tar.bz2
rpm-39d03aa29e19bcb01471de836c5d0793ab8d9e5c.zip
i18nation
CVS patchset: 3598 CVS date: 2000/02/28 20:00:31
Diffstat (limited to 'python')
-rw-r--r--python/rpmmodule.c24
1 files 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: