summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-05-16 15:55:44 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-05-16 15:55:44 +0300
commit44bdb776b7d557941d377d0adfdedd2940546164 (patch)
tree13986b5045aa15f21bd6f661c10714933cff65b9 /lib
parenta81863d443f3916d9562009fb5374e20b7fbc70e (diff)
downloadlibrpm-tizen-44bdb776b7d557941d377d0adfdedd2940546164.tar.gz
librpm-tizen-44bdb776b7d557941d377d0adfdedd2940546164.tar.bz2
librpm-tizen-44bdb776b7d557941d377d0adfdedd2940546164.zip
Split format and tag extensions to separate tables
Diffstat (limited to 'lib')
-rw-r--r--lib/formats.c6
-rw-r--r--lib/header.c4
-rw-r--r--lib/header.h1
-rw-r--r--lib/headerfmt.c2
4 files changed, 9 insertions, 4 deletions
diff --git a/lib/formats.c b/lib/formats.c
index 08340f943..75d22c82b 100644
--- a/lib/formats.c
+++ b/lib/formats.c
@@ -1001,7 +1001,7 @@ static int groupTag(Header h, rpmtd td)
return i18nTag(h, RPMTAG_GROUP, td);
}
-const struct headerSprintfExtension_s rpmHeaderFormats[] = {
+const struct headerSprintfExtension_s rpmHeaderTagExtensions[] = {
{ HEADER_EXT_TAG, "RPMTAG_GROUP", { groupTag } },
{ HEADER_EXT_TAG, "RPMTAG_DESCRIPTION", { descriptionTag } },
{ HEADER_EXT_TAG, "RPMTAG_SUMMARY", { summaryTag } },
@@ -1014,6 +1014,10 @@ const struct headerSprintfExtension_s rpmHeaderFormats[] = {
{ HEADER_EXT_TAG, "RPMTAG_INSTALLPREFIX", { instprefixTag } },
{ HEADER_EXT_TAG, "RPMTAG_TRIGGERCONDS", { triggercondsTag } },
{ HEADER_EXT_TAG, "RPMTAG_TRIGGERTYPE", { triggertypeTag } },
+ { HEADER_EXT_LAST, NULL, { NULL } }
+};
+
+const struct headerSprintfExtension_s rpmHeaderFormats[] = {
{ HEADER_EXT_FORMAT, "armor", { armorFormat } },
{ HEADER_EXT_FORMAT, "base64", { base64Format } },
{ HEADER_EXT_FORMAT, "pgpsig", { pgpsigFormat } },
diff --git a/lib/header.c b/lib/header.c
index af25edda9..eb12af74e 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -1377,12 +1377,12 @@ void * headerFreeTag(Header h, rpm_data_t data, rpmTagType type)
static headerTagTagFunction findExtFunc(rpmTag tag)
{
- headerSprintfExtension ext = rpmHeaderFormats;
+ headerSprintfExtension ext = rpmHeaderTagExtensions;
headerTagTagFunction func = NULL;
const char *tagname = rpmTagGetName(tag);
for (; ext != NULL && ext->type != HEADER_EXT_LAST; ext++) {
- if (ext->name == NULL || ext->type != HEADER_EXT_TAG)
+ if (ext->name == NULL)
continue;
if (!rstrcasecmp(ext->name + sizeof("RPMTAG"), tagname)) {
func = ext->u.tagFunction;
diff --git a/lib/header.h b/lib/header.h
index 8e9ff7dce..e6cca0385 100644
--- a/lib/header.h
+++ b/lib/header.h
@@ -103,6 +103,7 @@ extern headerTagIndices const rpmTags;
* Table of query format extensions.
*/
extern const struct headerSprintfExtension_s rpmHeaderFormats[];
+extern const struct headerSprintfExtension_s rpmHeaderTagExtensions[];
/** \ingroup header
* Include calculation for 8 bytes of (magic, 0)?
diff --git a/lib/headerfmt.c b/lib/headerfmt.c
index d13df61b0..95eda3c8c 100644
--- a/lib/headerfmt.c
+++ b/lib/headerfmt.c
@@ -245,7 +245,7 @@ bingo:
/* Search extensions for specific format. */
if (stag->type != NULL)
for (; ext != NULL && ext->type != HEADER_EXT_LAST; ext++) {
- if (ext->name == NULL || ext->type != HEADER_EXT_FORMAT)
+ if (ext->name == NULL)
continue;
if (!strcmp(ext->name, stag->type)) {
stag->fmt = ext->u.formatFunction;