summaryrefslogtreecommitdiff
path: root/rpmdb
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-07-16 13:13:46 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-07-16 13:13:46 +0300
commit6388d220bff107f26116345708e0aa69890bcd14 (patch)
treed6d822a8d1f9951e16fb9bda51e6d9c3133ffcf4 /rpmdb
parent892e8fe2954f64c6d129c57f86d1d4348f2fe23e (diff)
downloadrpm-6388d220bff107f26116345708e0aa69890bcd14.tar.gz
rpm-6388d220bff107f26116345708e0aa69890bcd14.tar.bz2
rpm-6388d220bff107f26116345708e0aa69890bcd14.zip
Use simple and stoopid linear tagType lookup for now.
Diffstat (limited to 'rpmdb')
-rw-r--r--rpmdb/tagname.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/rpmdb/tagname.c b/rpmdb/tagname.c
index 8cb21e10a..49143da3b 100644
--- a/rpmdb/tagname.c
+++ b/rpmdb/tagname.c
@@ -7,28 +7,17 @@
#include <rpmlib.h>
#include "debug.h"
-/*@access headerTagTableEntry @*/
-
-static int tagcmp(const void * a, const void * b)
- /*@*/
-{
- const headerTagTableEntry aptr = (const headerTagTableEntry) a;
- const headerTagTableEntry bptr = (const headerTagTableEntry) b;
- return (aptr->val - bptr->val);
-}
-
int tagType(int tag)
{
- headerTagTableEntry t = memset(alloca(sizeof(*t)), 0, sizeof(*t));
- headerTagTableEntry needle;
int tagtype = RPM_NULL_TYPE;
+ int i;
- t->val = tag;
-/*@-boundswrite@*/
- needle = bsearch(t, rpmTagTable, rpmTagTableSize, sizeof(*t), tagcmp);
-/*@=boundswrite@*/
- if (needle != NULL)
- tagtype = needle->type;
+ for (i = 0; i < rpmTagTableSize; i++) {
+ if (tag != rpmTagTable[i].val)
+ continue;
+ tagtype = rpmTagTable[i].type;
+ break;
+ }
return tagtype;
}