From 2525d192304246d366e08974ccfabb6bfdfc5ff4 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 21 May 2008 17:03:15 +0300 Subject: [PATCH] Dom't muck with rpmTagTable internals in rpmDisplayQueryTags() --- lib/query.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/query.c b/lib/query.c index c637b2e..35c9aa2 100644 --- a/lib/query.c +++ b/lib/query.c @@ -253,27 +253,28 @@ exit: void rpmDisplayQueryTags(FILE * fp) { - const struct headerTagTableEntry_s * t; - int i, ttype; - - for (i = 0, t = rpmTagTable; i < rpmTagTableSize; i++, t++) { - if (t->name == NULL) - continue; + static const char * const tagTypeNames[] = { + "", "char", "int8", "int16", "int32", "int64", + "string", "blob", "argv", "i18nstring" + }; + const char *tname, *sname; + rpmtd names = rpmTagGetNames(1); + + while ((tname = rpmtdNextString(names))) { + sname = tname + strlen("RPMTAG_"); if (rpmIsVerbose()) { - static const char * const tagtypes[] = { - "", "char", "int8", "int16", "int32", "int64", - "string", "blob", "argv", "i18nstring" - }; - fprintf(fp, "%-20s %6d", t->name + 7, t->val); - ttype = t->type & RPM_MASK_TYPE; - if (ttype > RPM_NULL_TYPE && ttype <= RPM_MAX_TYPE) - fprintf(fp, " %s", tagtypes[ttype]); + rpmTag tag = rpmTagGetValue(tname); + rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE; + fprintf(fp, "%-20s %6d", sname, tag); + if (type > RPM_NULL_TYPE && type <= RPM_MAX_TYPE) + fprintf(fp, " %s", tagTypeNames[type]); } else { - fprintf(fp, "%s", t->name + 7); + fprintf(fp, "%s", sname); } - fprintf(fp, "\n"); } + rpmtdFreeData(names); + rpmtdFree(names); } static int rpmgiShowMatches(QVA_t qva, rpmts ts) -- 2.7.4