Eliminate the now unnecessary extension type fields
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 16 May 2008 13:07:41 +0000 (16:07 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 16 May 2008 13:07:41 +0000 (16:07 +0300)
lib/formats.c
lib/header.c
lib/header.h
lib/headerfmt.c

index 75d22c8..1f26450 100644 (file)
@@ -1002,35 +1002,35 @@ static int groupTag(Header h, rpmtd td)
 }
 
 const struct headerSprintfExtension_s rpmHeaderTagExtensions[] = {
-    { HEADER_EXT_TAG, "RPMTAG_GROUP",          { groupTag } },
-    { HEADER_EXT_TAG, "RPMTAG_DESCRIPTION",    { descriptionTag } },
-    { HEADER_EXT_TAG, "RPMTAG_SUMMARY",                { summaryTag } },
-    { HEADER_EXT_TAG, "RPMTAG_FILECLASS",      { fileclassTag } },
-    { HEADER_EXT_TAG, "RPMTAG_FILENAMES",      { filenamesTag } },
-    { HEADER_EXT_TAG, "RPMTAG_FILEPROVIDE",    { fileprovideTag } },
-    { HEADER_EXT_TAG, "RPMTAG_FILEREQUIRE",    { filerequireTag } },
-    { HEADER_EXT_TAG, "RPMTAG_FSNAMES",                { fsnamesTag } },
-    { HEADER_EXT_TAG, "RPMTAG_FSSIZES",                { fssizesTag } },
-    { HEADER_EXT_TAG, "RPMTAG_INSTALLPREFIX",  { instprefixTag } },
-    { HEADER_EXT_TAG, "RPMTAG_TRIGGERCONDS",   { triggercondsTag } },
-    { HEADER_EXT_TAG, "RPMTAG_TRIGGERTYPE",    { triggertypeTag } },
-    { HEADER_EXT_LAST, NULL,                   { NULL } }
+    { "RPMTAG_GROUP",          { groupTag } },
+    { "RPMTAG_DESCRIPTION",    { descriptionTag } },
+    { "RPMTAG_SUMMARY",                { summaryTag } },
+    { "RPMTAG_FILECLASS",      { fileclassTag } },
+    { "RPMTAG_FILENAMES",      { filenamesTag } },
+    { "RPMTAG_FILEPROVIDE",    { fileprovideTag } },
+    { "RPMTAG_FILEREQUIRE",    { filerequireTag } },
+    { "RPMTAG_FSNAMES",                { fsnamesTag } },
+    { "RPMTAG_FSSIZES",                { fssizesTag } },
+    { "RPMTAG_INSTALLPREFIX",  { instprefixTag } },
+    { "RPMTAG_TRIGGERCONDS",   { triggercondsTag } },
+    { "RPMTAG_TRIGGERTYPE",    { triggertypeTag } },
+    { NULL,                    { NULL } }
 };
 
 const struct headerSprintfExtension_s rpmHeaderFormats[] = {
-    { HEADER_EXT_FORMAT, "armor",              { armorFormat } },
-    { HEADER_EXT_FORMAT, "base64",             { base64Format } },
-    { HEADER_EXT_FORMAT, "pgpsig",             { pgpsigFormat } },
-    { HEADER_EXT_FORMAT, "depflags",           { depflagsFormat } },
-    { HEADER_EXT_FORMAT, "fflags",             { fflagsFormat } },
-    { HEADER_EXT_FORMAT, "perms",              { permsFormat } },
-    { HEADER_EXT_FORMAT, "permissions",                { permsFormat } },
-    { HEADER_EXT_FORMAT, "triggertype",                { triggertypeFormat } },
-    { HEADER_EXT_FORMAT, "xml",                        { xmlFormat } },
-    { HEADER_EXT_FORMAT, "octal",              { octalFormat } },
-    { HEADER_EXT_FORMAT, "hex",                { hexFormat } },
-    { HEADER_EXT_FORMAT, "date",               { dateFormat } },
-    { HEADER_EXT_FORMAT, "day",                { dayFormat } },
-    { HEADER_EXT_FORMAT, "shescape",           { shescapeFormat } },
-    { HEADER_EXT_LAST, NULL,                   { NULL } }
+    { "armor",         { armorFormat } },
+    { "base64",                { base64Format } },
+    { "pgpsig",                { pgpsigFormat } },
+    { "depflags",      { depflagsFormat } },
+    { "fflags",                { fflagsFormat } },
+    { "perms",         { permsFormat } },
+    { "permissions",   { permsFormat } },
+    { "triggertype",   { triggertypeFormat } },
+    { "xml",           { xmlFormat } },
+    { "octal",                 { octalFormat } },
+    { "hex",           { hexFormat } },
+    { "date",          { dateFormat } },
+    { "day",           { dayFormat } },
+    { "shescape",      { shescapeFormat } },
+    { NULL,            { NULL } }
 };
index eb12af7..5f0606d 100644 (file)
@@ -1381,9 +1381,7 @@ static headerTagTagFunction findExtFunc(rpmTag tag)
     headerTagTagFunction func = NULL;
     const char *tagname = rpmTagGetName(tag);
 
-    for (; ext != NULL && ext->type != HEADER_EXT_LAST; ext++) {
-       if (ext->name == NULL)
-           continue;
+    for (; ext != NULL && ext->name != NULL; ext++) {
        if (!rstrcasecmp(ext->name + sizeof("RPMTAG"), tagname)) {
            func = ext->u.tagFunction;
            break;
index e6cca03..e74566c 100644 (file)
@@ -38,14 +38,6 @@ struct headerTagTableEntry_s {
 typedef struct headerTagIndices_s * headerTagIndices;
 
 /** \ingroup header
- */
-enum headerSprintfExtensionType {
-    HEADER_EXT_LAST = 0,       /*!< End of extension chain. */
-    HEADER_EXT_FORMAT,         /*!< headerTagFormatFunction() extension */
-    HEADER_EXT_TAG             /*!< headerTagTagFunction() extension */
-};
-
-/** \ingroup header
  * HEADER_EXT_FORMAT format function prototype.
  * This will only ever be passed RPM_INT32_TYPE or RPM_STRING_TYPE to
  * help keep things simple.
@@ -76,7 +68,6 @@ typedef int (*headerTagTagFunction) (Header h, rpmtd td);
  */
 typedef const struct headerSprintfExtension_s * headerSprintfExtension;
 struct headerSprintfExtension_s {
-    enum headerSprintfExtensionType type;      /*!< Type of extension. */
     const char * name;                         /*!< Name of extension. */
     union {
        void * generic;                         /*!< Private extension. */
index 95eda3c..8b941ad 100644 (file)
@@ -244,9 +244,7 @@ static int findTag(headerSprintfArgs hsa, sprintfToken token, const char * name)
 bingo:
     /* Search extensions for specific format. */
     if (stag->type != NULL)
-    for (; ext != NULL && ext->type != HEADER_EXT_LAST; ext++) {
-       if (ext->name == NULL)
-           continue;
+    for (; ext != NULL && ext->name != NULL; ext++) {
        if (!strcmp(ext->name, stag->type)) {
            stag->fmt = ext->u.formatFunction;
            break;