summaryrefslogtreecommitdiff
path: root/rpmdb
diff options
context:
space:
mode:
Diffstat (limited to 'rpmdb')
-rwxr-xr-xrpmdb/gentagtbl.sh13
-rw-r--r--rpmdb/header.h3
-rw-r--r--rpmdb/tagname.c31
3 files changed, 25 insertions, 22 deletions
diff --git a/rpmdb/gentagtbl.sh b/rpmdb/gentagtbl.sh
index a4d674428..04ad2fe5e 100755
--- a/rpmdb/gentagtbl.sh
+++ b/rpmdb/gentagtbl.sh
@@ -61,14 +61,21 @@ ${AWK} '/[\t ](RPMTAG_[A-Z0-9]*)[ \t]+([0-9]*)/ && !/internal/ {
ta = "SCALAR"
}
if ($2 == "=") {
- printf(" { \"%s\", %s RPM_%s_TYPE + RPM_%s_RETURN_TYPE },\n", $1, $3, tt, ta)
+ tnarg = $1
} else {
- printf(" { \"%s\", %s, RPM_%s_TYPE + RPM_%s_RETURN_TYPE },\n", $2, $3, tt, ta)
+ tnarg = $2
+ }
+ tn = substr(tnarg, index(tnarg, "_") + 1)
+ sn = (substr(tn, 1, 1) tolower(substr(tn, 2)))
+ if ($2 == "=") {
+ printf(" { \"%s\", \"%s\", %s RPM_%s_TYPE + RPM_%s_RETURN_TYPE },\n", tnarg, sn, $3, tt, ta)
+ } else {
+ printf(" { \"%s\", \"%s\", %s, RPM_%s_TYPE + RPM_%s_RETURN_TYPE },\n", tnarg, sn, $3, tt, ta)
}
}' < $1 | sort
cat << EOF
- { NULL, 0, 0 }
+ { NULL, NULL, 0, 0 }
};
const struct headerTagTableEntry_s * const rpmTagTable = rpmTagTbl;
diff --git a/rpmdb/header.h b/rpmdb/header.h
index 1fead0144..0c6325546 100644
--- a/rpmdb/header.h
+++ b/rpmdb/header.h
@@ -25,7 +25,8 @@ extern "C" {
typedef struct headerTagTableEntry_s * headerTagTableEntry;
struct headerTagTableEntry_s {
const char * name; /*!< Tag name. */
- rpmTag val; /*!< Tag numeric value. */
+ const char * shortname; /*!< "Human readable" short name. */
+ rpmTag val; /*!< Tag numeric value. */
rpmTagType type; /*!< Tag type. */
};
diff --git a/rpmdb/tagname.c b/rpmdb/tagname.c
index 191db4d9f..93ec5f6c3 100644
--- a/rpmdb/tagname.c
+++ b/rpmdb/tagname.c
@@ -97,51 +97,49 @@ headerTagIndices const rpmTags = &_rpmTags;
static const char * _tagName(rpmTag tag)
{
- static char nameBuf[128]; /* XXX yuk */
+ const char *name = "(unknown)";
const struct headerTagTableEntry_s *t;
int comparison, i, l, u;
int xx;
- char *s;
if (_rpmTags.byValue == NULL)
xx = tagLoadIndex(&_rpmTags.byValue, &_rpmTags.byValueSize, tagCmpValue);
switch (tag) {
case RPMDBI_PACKAGES:
- strcpy(nameBuf, "Packages");
+ name = "Packages";
break;
case RPMDBI_DEPENDS:
- strcpy(nameBuf, "Depends");
+ name = "Depends";
break;
case RPMDBI_ADDED:
- strcpy(nameBuf, "Added");
+ name = "Added";
break;
case RPMDBI_REMOVED:
- strcpy(nameBuf, "Removed");
+ name = "Removed";
break;
case RPMDBI_AVAILABLE:
- strcpy(nameBuf, "Available");
+ name = "Available";
break;
case RPMDBI_HDLIST:
- strcpy(nameBuf, "Hdlist");
+ name = "Hdlist";
break;
case RPMDBI_ARGLIST:
- strcpy(nameBuf, "Arglist");
+ name = "Arglist";
break;
case RPMDBI_FTSWALK:
- strcpy(nameBuf, "Ftswalk");
+ name = "Ftswalk";
break;
/* XXX make sure rpmdb indices are identically named. */
case RPMTAG_CONFLICTS:
- strcpy(nameBuf, "Conflictname");
+ name = "Conflictname";
break;
case RPMTAG_HDRID:
- strcpy(nameBuf, "Sha1header");
+ name = "Sha1header";
break;
default:
- strcpy(nameBuf, "(unknown)");
if (_rpmTags.byValue == NULL)
break;
l = 0;
@@ -157,22 +155,19 @@ static const char * _tagName(rpmTag tag)
else if (comparison > 0)
l = i + 1;
else {
- nameBuf[0] = nameBuf[1] = '\0';
/* Make sure that the bsearch retrieve is stable. */
while (i > 0 && tag == _rpmTags.byValue[i-1]->val) {
i--;
}
t = _rpmTags.byValue[i];
if (t->name != NULL)
- strcpy(nameBuf, t->name + (sizeof("RPMTAG_")-1));
- for (s = nameBuf+1; *s != '\0'; s++)
- *s = rtolower(*s);
+ name = t->shortname;
break;
}
}
break;
}
- return nameBuf;
+ return name;
}
static rpmTagType _tagType(rpmTag tag)