RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 20-Oct-2007 03:47:18
Branch: HEAD Handle: 2007102002471700
Modified files:
rpm CHANGES system.h
rpm/lib rpmlib.h
rpm/rpmdb header.c rpmdb.c rpmtag.h
Log:
- mark myTagName() and myTagValue() linear lookup for destruction.
Summary:
Revision Changes Path
1.1737 +1 -0 rpm/CHANGES
2.444 +0 -1 rpm/lib/rpmlib.h
1.98 +45 -0 rpm/rpmdb/header.c
1.193 +1 -0 rpm/rpmdb/rpmdb.c
1.2 +2 -0 rpm/rpmdb/rpmtag.h
2.91 +4 -0 rpm/system.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1736 -r1.1737 CHANGES
--- rpm/CHANGES 20 Oct 2007 01:10:58 -0000 1.1736
+++ rpm/CHANGES 20 Oct 2007 01:47:17 -0000 1.1737
@@ -1,4 +1,5 @@
4.5 -> 5.0:
+ - jbj: mark myTagName() and myTagValue() linear lookup for destruction.
- jbj: create rpmdb/rpmtag.h, split from lib/rpmlib.h.
- jbj: make the --info field colons align correctly, more (#323221).
- jbj: fix :time and :date formats, pad --info spewage.
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmlib.h
============================================================================
$ cvs diff -u -r2.443 -r2.444 rpmlib.h
--- rpm/lib/rpmlib.h 20 Oct 2007 01:10:59 -0000 2.443
+++ rpm/lib/rpmlib.h 20 Oct 2007 01:47:17 -0000 2.444
@@ -10,7 +10,6 @@
#include "rpmmessages.h"
#include "rpmerr.h"
-#include <header.h>
#include <rpmtag.h>
#include "popt.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/header.c
============================================================================
$ cvs diff -u -r1.97 -r1.98 header.c
--- rpm/rpmdb/header.c 20 Oct 2007 01:10:59 -0000 1.97
+++ rpm/rpmdb/header.c 20 Oct 2007 01:47:17 -0000 1.98
@@ -1795,7 +1795,35 @@
/*@=type@*/
}
+/**
+ * Return tag data type from value.
+ * @param tag tag value
+ * @return tag data type, RPM_NULL_TYPE on not found.
+ */
+/*@unused@*/ static inline
+int tagType(int tag)
+ /*@*/
+{
+/*@-type@*/
+ return ((*rpmTags->tagType)(tag));
+/*@=type@*/
+}
+
+/**
+ * Return tag value from name.
+ * @param tagstr name of tag
+ * @return tag value, -1 on not found
+ */
+/*@unused@*/ static inline
+int tagValue(const char * tagstr)
+ /*@*/
+{
+/*@-type@*/
+ return ((*rpmTags->tagValue)(tagstr));
+/*@=type@*/
+}
/*@=redecl@*/
+
/** \ingroup header
* Retrieve extension or tag value.
*
@@ -2669,6 +2697,7 @@
return hsa->val + hsa->vallen;
}
+#if defined(SUPPORT_LINEAR_TAGTABLE_LOOKUP)
/**
* Return tag name from value.
* @todo bsearch on sorted value table.
@@ -2719,6 +2748,7 @@
}
return 0;
}
+#endif
/**
* Search extensions and tags for a name.
@@ -2766,7 +2796,11 @@
}
/* Search tag names. */
+#if defined(SUPPORT_LINEAR_TAGTABLE_LOOKUP)
stag->tag = myTagValue(hsa->tags, name);
+#else
+ stag->tag = tagValue(name);
+#endif
if (stag->tag != 0)
goto bingo;
@@ -3706,7 +3740,11 @@
!strcmp(spft->u.tag.type, "yaml"));
if (isxml) {
+#if defined(SUPPORT_LINEAR_TAGTABLE_LOOKUP)
const char * tagN = myTagName(hsa->tags, spft->u.tag.tag, NULL);
+#else
+ const char * tagN = tagName(spft->u.tag.tag);
+#endif
/* XXX display "Tag_0x01234567" for unknown tags. */
if (tagN == NULL) {
(void) snprintf(numbuf, sizeof(numbuf), "Tag_0x%08x",
@@ -3720,8 +3758,13 @@
hsa->vallen += (te - t);
}
if (isyaml) {
+#if defined(SUPPORT_LINEAR_TAGTABLE_LOOKUP)
int tagT = -1;
const char * tagN = myTagName(hsa->tags, spft->u.tag.tag, &tagT);
+#else
+ rpmTagType tagT = tagType(spft->u.tag.tag);
+ const char * tagN = tagName(spft->u.tag.tag);
+#endif
/* XXX display "Tag_0x01234567" for unknown tags. */
if (tagN == NULL) {
(void) snprintf(numbuf, sizeof(numbuf), "Tag_0x%08x",
@@ -3860,7 +3903,9 @@
hsa->fmt = xstrdup(fmt);
/*@-castexpose@*/ /* FIX: legacy API shouldn't change. */
hsa->exts = (headerSprintfExtension) extensions;
+#if defined(SUPPORT_LINEAR_TAGTABLE_LOOKUP)
hsa->tags = (headerTagTableEntry) tbltags;
+#endif
/*@=castexpose@*/
hsa->errmsg = NULL;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/rpmdb.c
============================================================================
$ cvs diff -u -r1.192 -r1.193 rpmdb.c
--- rpm/rpmdb/rpmdb.c 19 Oct 2007 00:36:47 -0000 1.192
+++ rpm/rpmdb/rpmdb.c 20 Oct 2007 01:47:17 -0000 1.193
@@ -13,6 +13,7 @@
#include <rpmurl.h>
#include <rpmmacro.h>
#include <rpmsq.h>
+#include <rpmtag.h>
#define _RPMEVR_INTERNAL /* XXX isInstallPrereq */
#include <rpmevr.h>
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/rpmtag.h
============================================================================
$ cvs diff -u -r1.1 -r1.2 rpmtag.h
--- rpm/rpmdb/rpmtag.h 20 Oct 2007 01:10:59 -0000 1.1
+++ rpm/rpmdb/rpmtag.h 20 Oct 2007 01:47:17 -0000 1.2
@@ -5,6 +5,8 @@
* \file rpmdb/rpmtag.h
*/
+#include <header.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ .
patch -p0 <<'@@ .'
Index: rpm/system.h
============================================================================
$ cvs diff -u -r2.90 -r2.91 system.h
--- rpm/system.h 15 Oct 2007 05:59:54 -0000 2.90
+++ rpm/system.h 20 Oct 2007 01:47:17 -0000 2.91
@@ -734,6 +734,10 @@
#define SUPPORT_RPMLEAD 0 /* XXX default is add lead. */
+#if 0
+#define SUPPORT_LINEAR_TAGTABLE_LOOKUP 0
+#endif
+
/**
* Turn off pgp/pgp5 signing (hasn't been looked at seriously for years).
*/
@@ .
Received on Sat Oct 20 03:47:18 2007