summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-09-20 13:23:58 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-09-20 13:23:58 +0300
commitf65d670f023616f472f4451c08f5e3ee298a9ddc (patch)
tree57b6cd2272d3042fc45dd21d7f13bb9d57b8802c
parent4df06c5df7dadab2baa85d80522044da9dbe5733 (diff)
downloadrpm-f65d670f023616f472f4451c08f5e3ee298a9ddc.tar.gz
rpm-f65d670f023616f472f4451c08f5e3ee298a9ddc.tar.bz2
rpm-f65d670f023616f472f4451c08f5e3ee298a9ddc.zip
Remove the "dressed" rpmHeaderGetEntry() from API
- only used by the python bindings, move it there...
-rw-r--r--lib/misc.c51
-rw-r--r--lib/rpmlib.h16
-rw-r--r--python/header-py.c62
3 files changed, 61 insertions, 68 deletions
diff --git a/lib/misc.c b/lib/misc.c
index 2fd3512e1..ddd728e6a 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -226,54 +226,3 @@ char * currentDirectory(void)
return currDir;
}
-/*
- * XXX This is a "dressed" entry to headerGetEntry to do:
- * 1) DIRNAME/BASENAME/DIRINDICES -> FILENAMES tag conversions.
- * 2) i18n lookaside (if enabled).
- */
-int rpmHeaderGetEntry(Header h, int_32 tag, int_32 *type,
- void **p, int_32 *c)
-{
- switch (tag) {
- case RPMTAG_OLDFILENAMES:
- { const char ** fl = NULL;
- int count;
- rpmfiBuildFNames(h, RPMTAG_BASENAMES, &fl, &count);
- if (count > 0) {
- *p = fl;
- if (c) *c = count;
- if (type) *type = RPM_STRING_ARRAY_TYPE;
- return 1;
- }
- if (c) *c = 0;
- return 0;
- } break;
-
- case RPMTAG_GROUP:
- case RPMTAG_DESCRIPTION:
- case RPMTAG_SUMMARY:
- { char fmt[128];
- const char * msgstr;
- const char * errstr;
-
- fmt[0] = '\0';
- (void) stpcpy( stpcpy( stpcpy( fmt, "%{"), tagName(tag)), "}\n");
-
- /* XXX FIXME: memory leak. */
- msgstr = headerSprintf(h, fmt, rpmTagTable, rpmHeaderFormats, &errstr);
- if (msgstr) {
- *p = (void *) msgstr;
- if (type) *type = RPM_STRING_TYPE;
- if (c) *c = 1;
- return 1;
- } else {
- if (c) *c = 0;
- return 0;
- }
- } break;
-
- default:
- return headerGetEntry(h, tag, type, p, c);
- break;
- }
-}
diff --git a/lib/rpmlib.h b/lib/rpmlib.h
index cf6cc4575..6698544fe 100644
--- a/lib/rpmlib.h
+++ b/lib/rpmlib.h
@@ -153,22 +153,6 @@ void headerMergeLegacySigs(Header h, const Header sigh);
*/
Header headerRegenSigHeader(const Header h, int noArchiveSize);
-/** \ingroup header
- * Retrieve tag info from header.
- * This is a "dressed" entry to headerGetEntry to do:
- * 1) DIRNAME/BASENAME/DIRINDICES -> FILENAMES tag conversions.
- * 2) i18n lookaside (if enabled).
- *
- * @param h header
- * @param tag tag
- * @retval type address of tag value data type
- * @retval p address of pointer to tag value(s)
- * @retval c address of number of values
- * @return 0 on success, 1 on bad magic, 2 on error
- */
-int rpmHeaderGetEntry(Header h, int_32 tag, int_32 *type,
- void **p, int_32 *c);
-
/**
* Automatically generated table of tag name/value pairs.
*/
diff --git a/python/header-py.c b/python/header-py.c
index 96fb82f28..4e2b83070 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -363,6 +363,66 @@ long tagNumFromPyObject (PyObject *item)
}
/** \ingroup py_c
+ * Retrieve tag info from header.
+ * This is a "dressed" entry to headerGetEntry to do:
+ * 1) DIRNAME/BASENAME/DIRINDICES -> FILENAMES tag conversions.
+ * 2) i18n lookaside (if enabled).
+ *
+ * @param h header
+ * @param tag tag
+ * @retval type address of tag value data type
+ * @retval p address of pointer to tag value(s)
+ * @retval c address of number of values
+ * @return 0 on success, 1 on bad magic, 2 on error
+ */
+static int dressedHeaderGetEntry(Header h, int_32 tag, int_32 *type,
+ void **p, int_32 *c)
+{
+ switch (tag) {
+ case RPMTAG_OLDFILENAMES:
+ { const char ** fl = NULL;
+ int count;
+ rpmfiBuildFNames(h, RPMTAG_BASENAMES, &fl, &count);
+ if (count > 0) {
+ *p = fl;
+ if (c) *c = count;
+ if (type) *type = RPM_STRING_ARRAY_TYPE;
+ return 1;
+ }
+ if (c) *c = 0;
+ return 0;
+ } break;
+
+ case RPMTAG_GROUP:
+ case RPMTAG_DESCRIPTION:
+ case RPMTAG_SUMMARY:
+ { char fmt[128];
+ const char * msgstr;
+ const char * errstr;
+
+ fmt[0] = '\0';
+ (void) stpcpy( stpcpy( stpcpy( fmt, "%{"), tagName(tag)), "}\n");
+
+ /* XXX FIXME: memory leak. */
+ msgstr = headerSprintf(h, fmt, rpmTagTable, rpmHeaderFormats, &errstr);
+ if (msgstr) {
+ *p = (void *) msgstr;
+ if (type) *type = RPM_STRING_TYPE;
+ if (c) *c = 1;
+ return 1;
+ } else {
+ if (c) *c = 0;
+ return 0;
+ }
+ } break;
+
+ default:
+ return headerGetEntry(h, tag, type, p, c);
+ break;
+ }
+}
+
+/** \ingroup py_c
*/
static PyObject * hdr_subscript(hdrObject * s, PyObject * item)
{
@@ -402,7 +462,7 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item)
return NULL;
}
- if (!rpmHeaderGetEntry(s->h, tag, &type, &data, &count)) {
+ if (!dressedHeaderGetEntry(s->h, tag, &type, &data, &count)) {
switch (tag) {
case RPMTAG_EPOCH:
case RPMTAG_NAME: