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: 26-Nov-2007 06:16:54
Branch: HEAD Handle: 2007112605164805
Modified files:
rpm CHANGES build.c
rpm/build files.c parseDescription.c parsePreamble.c
parsePrep.c parseScript.c parseSpec.c spec.c
rpm/lib depends.c rpmds.c rpmfi.c rpmgi.c rpmrollback.c
rpmte.c rpmts.c verify.c
rpm/perl RPM.xs RPM_Header.xs RPM_PackageIterator.xs
RPM_Spec.xs RPM_Transaction.xs
rpm/python rpmdb-py.c rpmps-py.c rpmrc-py.c rpmte-py.c
rpmts-py.c
rpm/rpmconstant rpmconstant.h rpmh2tbl
rpm/rpmdb Makefile.am fprint.h hdrfmt.c header.c
header_internal.h librpmdb.vers rpmtag.h
signature.h
rpm/tools rpm2cpio.c rpmcache.c
Removed files:
rpm/rpmdb hdrinline.h header.h
Log:
- jbj: Eliminate header.h and hdrinline.h.
Summary:
Revision Changes Path
1.1889 +1 -0 rpm/CHANGES
2.114 +0 -1 rpm/build.c
1.296 +0 -1 rpm/build/files.c
2.32 +0 -1 rpm/build/parseDescription.c
2.149 +0 -1 rpm/build/parsePreamble.c
2.94 +0 -1 rpm/build/parsePrep.c
2.53 +0 -1 rpm/build/parseScript.c
2.118 +0 -1 rpm/build/parseSpec.c
2.164 +0 -1 rpm/build/spec.c
1.367 +0 -1 rpm/lib/depends.c
2.87 +0 -1 rpm/lib/rpmds.c
2.106 +0 -1 rpm/lib/rpmfi.c
2.45 +0 -1 rpm/lib/rpmgi.c
1.29 +0 -1 rpm/lib/rpmrollback.c
2.73 +0 -1 rpm/lib/rpmte.c
2.127 +0 -1 rpm/lib/rpmts.c
2.180 +0 -1 rpm/lib/verify.c
1.25 +0 -1 rpm/perl/RPM.xs
1.17 +12 -12 rpm/perl/RPM_Header.xs
1.4 +0 -1 rpm/perl/RPM_PackageIterator.xs
1.8 +0 -1 rpm/perl/RPM_Spec.xs
1.10 +0 -1 rpm/perl/RPM_Transaction.xs
1.20 +0 -1 rpm/python/rpmdb-py.c
1.14 +0 -1 rpm/python/rpmps-py.c
1.22 +0 -1 rpm/python/rpmrc-py.c
1.24 +0 -1 rpm/python/rpmte-py.c
1.82 +0 -1 rpm/python/rpmts-py.c
1.5 +1 -2 rpm/rpmconstant/rpmconstant.h
1.8 +3 -5 rpm/rpmconstant/rpmh2tbl
1.92 +1 -1 rpm/rpmdb/Makefile.am
1.13 +0 -1 rpm/rpmdb/fprint.h
1.44 +0 -1 rpm/rpmdb/hdrfmt.c
1.44 +0 -474 rpm/rpmdb/hdrinline.h
1.137 +100 -369 rpm/rpmdb/header.c
1.78 +0 -535 rpm/rpmdb/header.h
1.37 +1 -3 rpm/rpmdb/header_internal.h
1.35 +14 -1 rpm/rpmdb/librpmdb.vers
1.16 +278 -0 rpm/rpmdb/rpmtag.h
1.4 +0 -2 rpm/rpmdb/signature.h
2.3 +0 -1 rpm/tools/rpm2cpio.c
2.27 +0 -1 rpm/tools/rpmcache.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1888 -r1.1889 CHANGES
--- rpm/CHANGES 26 Nov 2007 02:03:08 -0000 1.1888
+++ rpm/CHANGES 26 Nov 2007 05:16:48 -0000 1.1889
@@ -1,4 +1,5 @@
5.0a2 -> 5.0a3:
+ - jbj: Eliminate header.h and hdrinline.h.
- jbj: insure that HE_t in headerGet/headerNext is initialized sanely.
- jbj: python: lose rpmMergeHeaderFoo methods.
- jbj: eliminate headerFreeData, w00t!, just free all tag data.
@@ .
patch -p0 <<'@@ .'
Index: rpm/build.c
============================================================================
$ cvs diff -u -r2.113 -r2.114 build.c
--- rpm/build.c 24 Nov 2007 23:55:00 -0000 2.113
+++ rpm/build.c 26 Nov 2007 05:16:48 -0000 2.114
@@ -5,7 +5,6 @@
#include "system.h"
#include <rpmio.h>
-#include <header.h> /* XXX headerIsEntry */
#include <rpmcli.h>
#include <rpmbuild.h>
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/files.c
============================================================================
$ cvs diff -u -r1.295 -r1.296 files.c
--- rpm/build/files.c 26 Nov 2007 02:03:08 -0000 1.295
+++ rpm/build/files.c 26 Nov 2007 05:16:49 -0000 1.296
@@ -17,7 +17,6 @@
#include <rpmio_internal.h>
#include <fts.h>
-#include <header.h> /* XXX headerIsEntry, headerMacrosLoad, headerMacrosUnload */
#include <rpmbuild.h>
#include "cpio.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parseDescription.c
============================================================================
$ cvs diff -u -r2.31 -r2.32 parseDescription.c
--- rpm/build/parseDescription.c 24 Nov 2007 23:55:00 -0000 2.31
+++ rpm/build/parseDescription.c 26 Nov 2007 05:16:49 -0000 2.32
@@ -6,7 +6,6 @@
#include "system.h"
#include <rpmio.h>
-#include <header.h> /* XXX headerAddI18NString */
#include "rpmbuild.h"
#include "debug.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parsePreamble.c
============================================================================
$ cvs diff -u -r2.148 -r2.149 parsePreamble.c
--- rpm/build/parsePreamble.c 26 Nov 2007 02:03:08 -0000 2.148
+++ rpm/build/parsePreamble.c 26 Nov 2007 05:16:49 -0000 2.149
@@ -7,7 +7,6 @@
#include <rpmio_internal.h>
-#include <header.h> /* XXX headerIsEntry, headerAddI18NString, headerCopyTags */
#define _RPMEVR_INTERNAL
#include <rpmbuild.h>
#include "debug.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parsePrep.c
============================================================================
$ cvs diff -u -r2.93 -r2.94 parsePrep.c
--- rpm/build/parsePrep.c 24 Nov 2007 23:55:00 -0000 2.93
+++ rpm/build/parsePrep.c 26 Nov 2007 05:16:49 -0000 2.94
@@ -6,7 +6,6 @@
#include "system.h"
#include <rpmio.h>
-#include <header.h> /* XXX headerNEVRA */
#include <rpmbuild.h>
#include "debug.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parseScript.c
============================================================================
$ cvs diff -u -r2.52 -r2.53 parseScript.c
--- rpm/build/parseScript.c 24 Nov 2007 23:55:00 -0000 2.52
+++ rpm/build/parseScript.c 26 Nov 2007 05:16:49 -0000 2.53
@@ -6,7 +6,6 @@
#include "system.h"
#include <rpmio.h>
-#include <header.h> /* XXX headerIsEntry */
#define _RPMEVR_INTERNAL
#include "rpmbuild.h"
#include "debug.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parseSpec.c
============================================================================
$ cvs diff -u -r2.117 -r2.118 parseSpec.c
--- rpm/build/parseSpec.c 24 Nov 2007 23:55:00 -0000 2.117
+++ rpm/build/parseSpec.c 26 Nov 2007 05:16:49 -0000 2.118
@@ -6,7 +6,6 @@
#include "system.h"
#include <rpmio_internal.h>
-#include <header.h> /* XXX headerIsEntry */
#include <rpmbuild.h>
#include "rpmds.h"
#include "rpmts.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/spec.c
============================================================================
$ cvs diff -u -r2.163 -r2.164 spec.c
--- rpm/build/spec.c 24 Nov 2007 23:55:00 -0000 2.163
+++ rpm/build/spec.c 26 Nov 2007 05:16:49 -0000 2.164
@@ -6,7 +6,6 @@
#include "system.h"
#include <rpmio.h>
-#include <header.h> /* XXX headerNew, headerFree */
#include "buildio.h"
#include "rpmds.h"
#include "rpmfi.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/depends.c
============================================================================
$ cvs diff -u -r1.366 -r1.367 depends.c
--- rpm/lib/depends.c 24 Nov 2007 23:55:01 -0000 1.366
+++ rpm/lib/depends.c 26 Nov 2007 05:16:50 -0000 1.367
@@ -5,7 +5,6 @@
#include "system.h"
#include "rpmio_internal.h" /* XXX PGPHASHALGO_MD5 */
-#include <header.h> /* XXX hGetColor, headerIsEntry */
#include <rpmcli.h> /* XXX rpmcliPackagesTotal */
#include <rpmmacro.h> /* XXX rpmExpand("%{_dependency_whiteout}" */
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmds.c
============================================================================
$ cvs diff -u -r2.86 -r2.87 rpmds.c
--- rpm/lib/rpmds.c 26 Nov 2007 02:03:09 -0000 2.86
+++ rpm/lib/rpmds.c 26 Nov 2007 05:16:50 -0000 2.87
@@ -78,7 +78,6 @@
#include <rpmio_internal.h> /* XXX fdGetFILE */
#include <rpmcb.h> /* XXX fnpyKey */
#include <rpmmacro.h>
-#include <header.h> /* XXX headerFree, headerNEVRA, headerLink */
#include <rpmlib.h>
#define _RPMDS_INTERNAL
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmfi.c
============================================================================
$ cvs diff -u -r2.105 -r2.106 rpmfi.c
--- rpm/lib/rpmfi.c 24 Nov 2007 23:55:01 -0000 2.105
+++ rpm/lib/rpmfi.c 26 Nov 2007 05:16:50 -0000 2.106
@@ -8,7 +8,6 @@
#include <rpmio.h>
#include <rpmcb.h> /* XXX fnpyKey */
#include <rpmurl.h> /* XXX urlGetPath */
-#include <header.h> /* XXX headerFree, headerIsEntry, headerLink, headerMacrosLoad, headerMacrosUnload */
#include <rpmlib.h>
#include "cpio.h" /* XXX CPIO_FOO */
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmgi.c
============================================================================
$ cvs diff -u -r2.44 -r2.45 rpmgi.c
--- rpm/lib/rpmgi.c 24 Nov 2007 23:55:01 -0000 2.44
+++ rpm/lib/rpmgi.c 26 Nov 2007 05:16:50 -0000 2.45
@@ -7,7 +7,6 @@
#include <rpmio.h>
#include <rpmcb.h> /* XXX fnpyKey */
#include <rpmmacro.h> /* XXX rpmExpand */
-#include <header.h> /* XXX headerFree, headerLink. headerGetInstance */
#include <rpmlib.h>
#include <rpmte.h> /* XXX rpmElementType */
#include <pkgio.h> /* XXX rpmElementType */
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmrollback.c
============================================================================
$ cvs diff -u -r1.28 -r1.29 rpmrollback.c
--- rpm/lib/rpmrollback.c 24 Nov 2007 23:55:01 -0000 1.28
+++ rpm/lib/rpmrollback.c 26 Nov 2007 05:16:50 -0000 1.29
@@ -5,7 +5,6 @@
#include "system.h"
#include <rpmio.h>
-#include <header.h> /* XXX headerFree, headerLink, headerIsEntry, headerGetOrigin */
#include <rpmcli.h>
#include "rpmdb.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmte.c
============================================================================
$ cvs diff -u -r2.72 -r2.73 rpmte.c
--- rpm/lib/rpmte.c 26 Nov 2007 02:03:09 -0000 2.72
+++ rpm/lib/rpmte.c 26 Nov 2007 05:16:50 -0000 2.73
@@ -6,7 +6,6 @@
#include <rpmio.h>
#include <rpmcb.h> /* XXX fnpyKey */
-#include <header.h> /* XXX headerFree, headerLink. headerIsEntry */
#include <rpmlib.h>
#include "rpmds.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmts.c
============================================================================
$ cvs diff -u -r2.126 -r2.127 rpmts.c
--- rpm/lib/rpmts.c 24 Nov 2007 23:55:01 -0000 2.126
+++ rpm/lib/rpmts.c 26 Nov 2007 05:16:50 -0000 2.127
@@ -7,7 +7,6 @@
#include "rpmio_internal.h" /* XXX for pgp and beecrypt */
#include <rpmcb.h> /* XXX fnpyKey */
#include <rpmmacro.h> /* XXX rpmtsOpenDB() needs rpmGetPath */
-#include <header.h> /* XXX headerFree, headerLink */
#include <rpmlib.h>
#define _RPMDB_INTERNAL /* XXX almost opaque sigh */
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/verify.c
============================================================================
$ cvs diff -u -r2.179 -r2.180 verify.c
--- rpm/lib/verify.c 24 Nov 2007 23:55:01 -0000 2.179
+++ rpm/lib/verify.c 26 Nov 2007 05:16:50 -0000 2.180
@@ -6,7 +6,6 @@
#include "system.h"
#include <rpmio.h>
-#include <header.h> /* XXX headerFree, headerLink, headerIsEntry */
#define _RPMPS_INTERNAL /* XXX rpmps needs iterator. */
#include <rpmcli.h>
@@ .
patch -p0 <<'@@ .'
Index: rpm/perl/RPM.xs
============================================================================
$ cvs diff -u -r1.24 -r1.25 RPM.xs
--- rpm/perl/RPM.xs 22 Nov 2007 22:28:16 -0000 1.24
+++ rpm/perl/RPM.xs 26 Nov 2007 05:16:50 -0000 1.25
@@ -14,7 +14,6 @@
#include "rpmio.h"
#include "rpmlog.h"
#include "rpmmacro.h"
-#include "header.h"
#include "rpmdb.h"
#include "rpmcli.h"
#include "rpmts.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/perl/RPM_Header.xs
============================================================================
$ cvs diff -u -r1.16 -r1.17 RPM_Header.xs
--- rpm/perl/RPM_Header.xs 26 Nov 2007 02:03:09 -0000 1.16
+++ rpm/perl/RPM_Header.xs 26 Nov 2007 05:16:50 -0000 1.17
@@ -11,7 +11,6 @@
#include <utime.h>
#include <rpmio.h>
-#include <header.h>
#include "rpmdb.h"
#include "rpmcli.h"
#include <pkgio.h>
@@ -212,15 +211,16 @@
Header h
SV * sv_tag
PREINIT:
- rpmTag tag = -1;
+ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
CODE:
+ he->tag = 0xffffffff;
if (SvIOK(sv_tag)) {
- tag = SvIV(sv_tag);
+ he->tag = SvIV(sv_tag);
} else if (SvPOK(sv_tag)) {
- tag = tagValue(SvPV_nolen(sv_tag));
+ he->tag = tagValue(SvPV_nolen(sv_tag));
}
- if (tag > 0)
- RETVAL = headerRemoveEntry(h, tag);
+ if (he->tag > 0 && he->tag < 0xffffffff)
+ RETVAL = headerDel(h, he, 0);
else
RETVAL = 1;
OUTPUT:
@@ -238,14 +238,14 @@
int i;
STRLEN len;
CODE:
- he->tag = -1;
+ he->tag = 0xffffffff;
if (SvIOK(sv_tag)) {
he->tag = SvIV(sv_tag);
} else if (SvPOK(sv_tag)) {
he->tag = tagValue(SvPV_nolen(sv_tag));
}
he->t = sv2constant(sv_tagtype, "rpmtagtype");
- if (he->tag > 0)
+ if (he->tag > 0 && he->tag < 0xffffffff)
RETVAL = 1;
else
RETVAL = 0;
@@ -260,21 +260,21 @@
he->p.ui32p = &ivalue;
he->c = 1;
he->append = 1;
- RETVAL = headerAddOrAppendEntry(h, he->tag, he->t, he->p.ptr, he->c);
+ RETVAL = headerPut(h, he, 0);
he->append = 0;
break;
case RPM_BIN_TYPE:
value = (char *)SvPV(ST(i), len);
he->p.ptr = &value;
he->c = len;
- RETVAL = headerAddEntry(h, he->tag, he->t, he->p.ptr, he->c);
+ RETVAL = headerPut(h, he, 0);
break;
case RPM_STRING_ARRAY_TYPE:
value = SvPV_nolen(ST(i));
he->p.ptr = &value;
he->c = 1;
he->append = 1;
- RETVAL = headerAddOrAppendEntry(h, he->tag, he->t, he->p.ptr, he->c);
+ RETVAL = headerPut(h, he, 0);
he->append = 0;
break;
default:
@@ -282,7 +282,7 @@
he->p.ptr = value;
he->c = 1;
he->append = 1;
- RETVAL = headerAddOrAppendEntry(h, he->tag, he->t, he->p.ptr, he->c);
+ RETVAL = headerPut(h, he, 0);
he->append = 0;
break;
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/perl/RPM_PackageIterator.xs
============================================================================
$ cvs diff -u -r1.3 -r1.4 RPM_PackageIterator.xs
--- rpm/perl/RPM_PackageIterator.xs 22 Nov 2007 22:28:16 -0000 1.3
+++ rpm/perl/RPM_PackageIterator.xs 26 Nov 2007 05:16:50 -0000 1.4
@@ -11,7 +11,6 @@
#include <utime.h>
#include <rpmio.h>
-#include "header.h"
#include "rpmcli.h"
#include "rpmts.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/perl/RPM_Spec.xs
============================================================================
$ cvs diff -u -r1.7 -r1.8 RPM_Spec.xs
--- rpm/perl/RPM_Spec.xs 26 Nov 2007 02:03:09 -0000 1.7
+++ rpm/perl/RPM_Spec.xs 26 Nov 2007 05:16:50 -0000 1.8
@@ -6,7 +6,6 @@
#undef Mkdir
#undef Stat
-#include "header.h" /* XXX headerIsEntry, headerLink */
#include "rpmlib.h"
#include "rpmio.h"
#include "rpmcli.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/perl/RPM_Transaction.xs
============================================================================
$ cvs diff -u -r1.9 -r1.10 RPM_Transaction.xs
--- rpm/perl/RPM_Transaction.xs 22 Nov 2007 22:28:16 -0000 1.9
+++ rpm/perl/RPM_Transaction.xs 26 Nov 2007 05:16:50 -0000 1.10
@@ -11,7 +11,6 @@
#include <utime.h>
#include "rpmio.h"
-#include "header.h"
#include "rpmcli.h"
#include "rpmts.h"
#include "rpmte.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/python/rpmdb-py.c
============================================================================
$ cvs diff -u -r1.19 -r1.20 rpmdb-py.c
--- rpm/python/rpmdb-py.c 22 Nov 2007 22:28:17 -0000 1.19
+++ rpm/python/rpmdb-py.c 26 Nov 2007 05:16:51 -0000 1.20
@@ -6,7 +6,6 @@
#include <rpmio.h>
#include <rpmcb.h> /* XXX fnpyKey */
-#include <header.h>
#include <rpmlib.h>
#include "rpmdb-py.h"
@@ .
patch -p0 <<'@@ .'
Index: rpm/python/rpmps-py.c
============================================================================
$ cvs diff -u -r1.13 -r1.14 rpmps-py.c
--- rpm/python/rpmps-py.c 22 Nov 2007 22:28:17 -0000 1.13
+++ rpm/python/rpmps-py.c 26 Nov 2007 05:16:51 -0000 1.14
@@ -7,7 +7,6 @@
#include <rpmio.h>
#include <rpmcb.h> /* XXX fnpyKey */
-#include <header.h>
#define _RPMPS_INTERNAL /* XXX rpmps needs iterator */
#include <rpmlib.h>
@@ .
patch -p0 <<'@@ .'
Index: rpm/python/rpmrc-py.c
============================================================================
$ cvs diff -u -r1.21 -r1.22 rpmrc-py.c
--- rpm/python/rpmrc-py.c 22 Nov 2007 22:28:17 -0000 1.21
+++ rpm/python/rpmrc-py.c 26 Nov 2007 05:16:51 -0000 1.22
@@ -7,7 +7,6 @@
#include "structmember.h"
#include <rpmio.h>
-#include <header.h>
#include "rpmdebug-py.c"
#include <rpmcli.h>
@@ .
patch -p0 <<'@@ .'
Index: rpm/python/rpmte-py.c
============================================================================
$ cvs diff -u -r1.23 -r1.24 rpmte-py.c
--- rpm/python/rpmte-py.c 22 Nov 2007 22:28:17 -0000 1.23
+++ rpm/python/rpmte-py.c 26 Nov 2007 05:16:51 -0000 1.24
@@ -6,7 +6,6 @@
#include <rpmio.h>
#include <rpmcb.h> /* XXX fnpyKey */
-#include <header.h>
#include <rpmlib.h>
#include "header-py.h" /* XXX tagNumFromPyObject */
@@ .
patch -p0 <<'@@ .'
Index: rpm/python/rpmts-py.c
============================================================================
$ cvs diff -u -r1.81 -r1.82 rpmts-py.c
--- rpm/python/rpmts-py.c 26 Nov 2007 02:03:09 -0000 1.81
+++ rpm/python/rpmts-py.c 26 Nov 2007 05:16:51 -0000 1.82
@@ -6,7 +6,6 @@
#include <rpmio_internal.h> /* XXX for fdSetOpen */
-#include <header.h> /* XXX headerGetEntry, headerFree */
#define _RPMPS_INTERNAL /* XXX almost (but not quite) opaque. */
#include <rpmcli.h>
#include <rpmpgp.h>
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmconstant/rpmconstant.h
============================================================================
$ cvs diff -u -r1.4 -r1.5 rpmconstant.h
--- rpm/rpmconstant/rpmconstant.h 19 Nov 2007 18:57:58 -0000 1.4
+++ rpm/rpmconstant/rpmconstant.h 26 Nov 2007 05:16:52 -0000 1.5
@@ -1,5 +1,5 @@
/* Nanar <nanardon@zarb.org>
- * $Id: rpmconstant.h,v 1.4 2007/11/19 18:57:58 jbj Exp $
+ * $Id: rpmconstant.h,v 1.5 2007/11/26 05:16:52 jbj Exp $
*/
#ifndef H_RPMCONSTANT
@@ -18,7 +18,6 @@
*
*/
-#include <header.h>
#include <rpmio.h>
#include <rpmcb.h> /* XXX fnpyKey */
#include <rpmdb.h>
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmconstant/rpmh2tbl
============================================================================
$ cvs diff -u -r1.7 -r1.8 rpmh2tbl
--- rpm/rpmconstant/rpmh2tbl 22 Nov 2007 09:02:00 -0000 1.7
+++ rpm/rpmconstant/rpmh2tbl 26 Nov 2007 05:16:52 -0000 1.8
@@ -15,7 +15,7 @@
##- along with this program; if not, write to the Free Software
##- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: rpmh2tbl,v 1.7 2007/11/22 09:02:00 nanardon Exp $
+# $Id: rpmh2tbl,v 1.8 2007/11/26 05:16:52 jbj Exp $
my @availlabletables;
@@ -32,6 +32,8 @@
'^(RPMTS_OP_[\w_]+)' => 'rpmtsOpX',
},
'rpmtag.h' => {
+ '^(HEADER_MAGIC_[\w_]+)' => 'rpmhMagic',
+ '^(RPM_[\w]+)_TYPE$' => 'rpmTagType',
'^(RPMTAG_[\w_]+)' => 'rpmTag',
},
'rpmlib.h' => {
@@ -59,10 +61,6 @@
'rpmdb.h' => {
'^(RPMMIRE_[\w_]+)' => 'rpmMireMode',
},
- 'header.h' => {
- '^(HEADER_MAGIC_[\w_]+)' => 'rpmhMagic',
- '^(RPM_[\w]+)_TYPE$' => 'rpmTagType',
- },
'rpmbuild.h' => {
'^(RPMBUILD_[\w_]+)' => 'rpmBuildFlags',
'^(PART_[\w_]+)' => 'rpmParseState',
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/Makefile.am
============================================================================
$ cvs diff -u -r1.91 -r1.92 Makefile.am
--- rpm/rpmdb/Makefile.am 24 Nov 2007 18:48:15 -0000 1.91
+++ rpm/rpmdb/Makefile.am 26 Nov 2007 05:16:52 -0000 1.92
@@ -27,7 +27,7 @@
tjfn_LDADD = librpmdb.la
pkgincdir = $(pkgincludedir)$(WITH_PATH_VERSIONED_SUFFIX)
-pkginc_HEADERS = header.h hdrinline.h pkgio.h rpmdb.h rpmtag.h signature.h rpmwf.h
+pkginc_HEADERS = pkgio.h rpmdb.h rpmtag.h signature.h rpmwf.h
noinst_HEADERS = fprint.h header_internal.h legacy.h
pkglibdir = @USRLIBRPM@
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/fprint.h
============================================================================
$ cvs diff -u -r1.12 -r1.13 fprint.h
--- rpm/rpmdb/fprint.h 14 Nov 2007 21:13:18 -0000 1.12
+++ rpm/rpmdb/fprint.h 26 Nov 2007 05:16:52 -0000 1.13
@@ -7,7 +7,6 @@
*/
#include "rpmhash.h"
-#include "header.h"
/**
*/
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/hdrfmt.c
============================================================================
$ cvs diff -u -r1.43 -r1.44 hdrfmt.c
--- rpm/rpmdb/hdrfmt.c 26 Nov 2007 02:03:10 -0000 1.43
+++ rpm/rpmdb/hdrfmt.c 26 Nov 2007 05:16:52 -0000 1.44
@@ -9,7 +9,6 @@
#include <rpmmacro.h> /* XXX for %_i18ndomains */
#define _RPMTAG_INTERNAL
-#include <header.h>
#include <rpmlib.h> /* XXX RPMFILE_FOO, rpmMkdirPath */
#define _RPMEVR_INTERNAL
@@ .
rm -f rpm/rpmdb/hdrinline.h <<'@@ .'
Index: rpm/rpmdb/hdrinline.h
============================================================================
[NO CHANGE SUMMARY BECAUSE FILE AS A WHOLE IS JUST REMOVED]
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/header.c
============================================================================
$ cvs diff -u -r1.136 -r1.137 header.c
--- rpm/rpmdb/header.c 26 Nov 2007 02:03:10 -0000 1.136
+++ rpm/rpmdb/header.c 26 Nov 2007 05:16:52 -0000 1.137
@@ -31,7 +31,6 @@
/*@access entryInfo @*/
/*@access indexEntry @*/
-/*@access HV_t @*/
/*@access FD_t @*/ /* XXX void * arg headerRead/headerWrite */
/** \ingroup header
@@ -88,9 +87,6 @@
/*@unchecked@*/
static size_t headerMaxbytes = (32*1024*1024);
-/*@observer@*/ /*@unchecked@*/
-HV_t hdrVec; /* forward reference */
-
/**
* Global header stats enabler.
*/
@@ -108,15 +104,7 @@
rpmop _hdr_getops = &hdr_getops;
/*@=compmempass@*/
-/** \ingroup header
- * Return header stats accumulator structure.
- * @param h header
- * @param opx per-header accumulator index (aka rpmtsOpX)
- * @return per-header accumulator pointer
- */
-static /*@null@*/
void * headerGetStats(Header h, int opx)
- /*@*/
{
rpmop op = NULL;
if (_hdr_stats)
@@ -127,14 +115,7 @@
return op;
}
-/** \ingroup header
- * Reference a header instance.
- * @param h header
- * @return referenced header instance
- */
-static
Header headerLink(Header h)
- /*@modifies h @*/
{
/*@-nullret@*/
if (h == NULL) return NULL;
@@ -151,14 +132,7 @@
/*@=refcounttrans @*/
}
-/** \ingroup header
- * Dereference a header instance.
- * @param h header
- * @return NULL always
- */
-static /*@null@*/
-Header headerUnlink(/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/
+Header headerUnlink(Header h)
{
if (h == NULL) return NULL;
/*@-modfilesys@*/
@@ -169,14 +143,7 @@
return NULL;
}
-/** \ingroup header
- * Dereference a header instance.
- * @param h header
- * @return NULL always
- */
-static /*@null@*/
-Header headerFree(/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/
+Header headerFree(Header h)
{
(void) headerUnlink(h);
@@ -218,20 +185,11 @@
/*@=usereleased@*/
}
-/** \ingroup header
- * Create new (empty) header instance.
- * @return header
- */
-static
Header headerNew(void)
- /*@*/
{
Header h = xcalloc(1, sizeof(*h));
(void) memcpy(h->magic, header_magic, sizeof(h->magic));
- /*@-assignexpose@*/
- h->hv = *hdrVec; /* structure assignment */
- /*@=assignexpose@*/
h->blob = NULL;
h->origin = NULL;
h->instance = 0;
@@ -304,14 +262,7 @@
qsort(h->index, h->indexUsed, sizeof(*h->index), offsetCmp);
}
-/** \ingroup header
- * Return size of on-disk header representation in bytes.
- * @param h header
- * @return size of on-disk header
- */
-static
-size_t headerSizeof(/*@null@*/ Header h)
- /*@modifies h @*/
+size_t headerSizeof(Header h)
{
indexEntry entry;
size_t size = 0;
@@ -597,16 +548,7 @@
}
/*@=globs@*/
-/** \ingroup header
- * @param h header
- * @retval *lenp no. bytes in unloaded header blob
- * @return unloaded header blob (NULL on error)
- */
-static /*@only@*/ /*@null@*/
-void * headerUnload(Header h, /*@out@*/ /*@null@*/ size_t * lenp)
- /*@modifies h, *lenp @*/
- /*@requires maxSet(lenp) >= 0 @*/
- /*@ensures maxRead(result) == (*lenp) @*/
+void * headerUnload(Header h, size_t * lenp)
{
void * sw;
uint32_t * ei = NULL;
@@ -981,14 +923,7 @@
return 0;
}
-/** \ingroup header
- * Convert header to in-memory representation.
- * @param uh on-disk header blob (i.e. with offsets)
- * @return header
- */
-static /*@null@*/
-Header headerLoad(/*@kept@*/ void * uh)
- /*@modifies uh @*/
+Header headerLoad(void * uh)
{
void * sw = NULL;
uint32_t * ei = (uint32_t *) uh;
@@ -1024,9 +959,6 @@
{ unsigned char * hmagic = (_newmagic ? meta_magic : header_magic);
(void) memcpy(h->magic, hmagic, sizeof(h->magic));
}
- /*@-assignexpose@*/
- h->hv = *hdrVec; /* structure assignment */
- /*@=assignexpose@*/
/*@-assignexpose -kepttrans@*/
h->blob = uh;
/*@=assignexpose =kepttrans@*/
@@ -1166,16 +1098,7 @@
/*@=refcounttrans =globstate@*/
}
-/** \ingroup header
- * Return header magic.
- * @param h header
- * @param *magicp magic array
- * @param *nmagicp no. bytes of magic
- * @return 0 always
- */
-static
-int headerGetMagic(/*@null@*/ Header h, unsigned char **magicp, size_t *nmagicp)
- /*@modifies *magicp, *nmagicp @*/
+int headerGetMagic(Header h, unsigned char ** magicp, size_t * nmagicp)
{
unsigned char * hmagic = (_newmagic ? meta_magic : header_magic);
if (magicp)
@@ -1185,16 +1108,7 @@
return 0;
}
-/** \ingroup header
- * Store header magic.
- * @param h header
- * @param magic magic array
- * @param nmagic no. bytes of magic
- * @return 0 always
- */
-static
-int headerSetMagic(/*@null@*/ Header h, unsigned char * magic, size_t nmagic)
- /*@modifies h @*/
+int headerSetMagic(Header h, unsigned char * magic, size_t nmagic)
{
if (nmagic > sizeof(h->magic))
nmagic = sizeof(h->magic);
@@ -1206,27 +1120,12 @@
return 0;
}
-/** \ingroup header
- * Return header origin (e.g path or URL).
- * @param h header
- * @return header origin
- */
-static /*@observer@*/ /*@null@*/
-const char * headerGetOrigin(/*@null@*/ Header h)
- /*@*/
+const char * headerGetOrigin(Header h)
{
return (h != NULL ? h->origin : NULL);
}
-/** \ingroup header
- * Store header origin (e.g path or URL).
- * @param h header
- * @param origin new header origin
- * @return 0 always
- */
-static
-int headerSetOrigin(/*@null@*/ Header h, const char * origin)
- /*@modifies h @*/
+int headerSetOrigin(Header h, const char * origin)
{
if (h != NULL) {
h->origin = _free(h->origin);
@@ -1235,43 +1134,19 @@
return 0;
}
-/** \ingroup header
- * Return header instance (if from rpmdb).
- * @param h header
- * @return header instance
- */
-static
-uint32_t headerGetInstance(/*@null@*/ Header h)
- /*@*/
+uint32_t headerGetInstance(Header h)
{
return (h != NULL ? h->instance : 0);
}
-/** \ingroup header
- * Store header instance (e.g path or URL).
- * @param h header
- * @param origin new header instance
- * @return 0 always
- */
-static
-uint32_t headerSetInstance(/*@null@*/ Header h, uint32_t instance)
- /*@modifies h @*/
+uint32_t headerSetInstance(Header h, uint32_t instance)
{
if (h != NULL)
h->instance = instance;
return 0;
}
-/** \ingroup header
- * Convert header to on-disk representation, and then reload.
- * This is used to insure that all header data is in one chunk.
- * @param h header (with pointers)
- * @param tag region tag
- * @return on-disk header (with offsets)
- */
-static /*@null@*/
-Header headerReload(/*@only@*/ Header h, int tag)
- /*@modifies h @*/
+Header headerReload(Header h, int tag)
{
Header nh;
void * uh;
@@ -1305,14 +1180,7 @@
return nh;
}
-/** \ingroup header
- * Make a copy and convert header to in-memory representation.
- * @param uh on-disk header blob (i.e. with offsets)
- * @return header
- */
-static /*@null@*/
Header headerCopyLoad(const void * uh)
- /*@*/
{
uint32_t * ei = (uint32_t *) uh;
uint32_t il = (uint32_t) ntohl(ei[0]); /* index length */
@@ -1335,15 +1203,7 @@
return h;
}
-/** \ingroup header
- * Check if tag is in header.
- * @param h header
- * @param tag tag
- * @return 1 on success, 0 on failure
- */
-static
-int headerIsEntry(/*@null@*/Header h, rpmTag tag)
- /*@*/
+int headerIsEntry(Header h, rpmTag tag)
{
/*@-mods@*/ /*@ FIX: h modified by sort. */
return (findEntry(h, tag, 0) ? 1 : 0);
@@ -1354,25 +1214,17 @@
* Retrieve data from header entry.
* @todo Permit retrieval of regions other than HEADER_IMUTABLE.
* @param entry header entry
- * @retval *type type (or NULL)
- * @retval *p data (or NULL)
- * @retval *c count (or NULL)
+ * @retval *he tag container
* @param minMem string pointers refer to header memory?
* @return 1 on success, otherwise error.
*/
-static int copyEntry(const indexEntry entry,
- /*@null@*/ /*@out@*/ rpmTagType * type,
- /*@null@*/ /*@out@*/ rpmTagData * p,
- /*@null@*/ /*@out@*/ rpmTagCount * c,
- int minMem)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
+static int copyEntry(const indexEntry entry, HE_t he, int minMem)
+ /*@modifies he @*/
{
rpmTagCount count = entry->info.count;
uint32_t rdlen;
int rc = 1; /* XXX 1 on success. */
- if (p)
switch (entry->info.type) {
case RPM_BIN_TYPE:
/*
@@ -1404,7 +1256,7 @@
rdl += REGION_TAG_COUNT;
}
- (*p).ui32p = ei = xmalloc(count);
+ he->p.ui32p = ei = xmalloc(count);
ei[0] = htonl(ril);
ei[1] = htonl(rdl);
@@ -1420,14 +1272,14 @@
rc = (rdlen == 0) ? 0 : 1;
} else {
count = entry->length;
- (*p).ptr = (!minMem
+ he->p.ptr = (!minMem
? memcpy(xmalloc(count), entry->data, count)
: entry->data);
}
break;
case RPM_STRING_TYPE:
if (count == 1) {
- (*p).str = entry->data;
+ he->p.str = entry->data;
break;
}
/*@fallthrough@*/
@@ -1440,10 +1292,10 @@
/*@-mods@*/
if (minMem) {
- (*p).argv = argv = xmalloc(nb);
+ he->p.argv = argv = xmalloc(nb);
t = entry->data;
} else {
- (*p).argv = argv = xmalloc(nb + entry->length);
+ he->p.argv = argv = xmalloc(nb + entry->length);
t = (char *) &argv[count];
memcpy(t, entry->data, entry->length);
}
@@ -1456,11 +1308,11 @@
} break;
default:
- (*p).ptr = entry->data;
+ he->p.ptr = entry->data;
break;
}
- if (type) *type = entry->info.type;
- if (c) *c = count;
+ he->t = entry->info.type;
+ he->c = count;
return rc;
}
@@ -1602,46 +1454,38 @@
/**
* Retrieve tag data from header.
* @param h header
- * @param tag tag to retrieve
- * @retval *type type (or NULL)
- * @retval *p data (or NULL)
- * @retval *c count (or NULL)
+ * @param he tag container
* @param minMem string pointers reference header memory?
* @return 1 on success, 0 on not found
*/
-static int intGetEntry(Header h, rpmTag tag,
- /*@null@*/ /*@out@*/ rpmTagType * type,
- /*@null@*/ /*@out@*/ rpmTagData * p,
- /*@null@*/ /*@out@*/ rpmTagCount * c,
- int minMem)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
+static int intGetEntry(Header h, HE_t he, int minMem)
+ /*@modifies he @*/
{
indexEntry entry;
int rc;
/* First find the tag */
/*@-mods@*/ /*@ FIX: h modified by sort. */
- entry = findEntry(h, tag, 0);
+ entry = findEntry(h, he->tag, 0);
/*@=mods@*/
if (entry == NULL) {
- if (type) type = 0;
- if (p) (*p).ptr = NULL;
- if (c) *c = 0;
+ he->t = 0;
+ he->p.ptr = NULL;
+ he->c = 0;
return 0;
}
switch (entry->info.type) {
case RPM_I18NSTRING_TYPE:
rc = 1;
- if (type) *type = RPM_STRING_TYPE;
- if (c) *c = 1;
- /*@-dependenttrans@*/
- if (p) (*p).str = headerFindI18NString(h, entry);
- /*@=dependenttrans@*/
+ he->t = RPM_STRING_TYPE;
+ he->c = 1;
+/*@-dependenttrans@*/
+ he->p.str = headerFindI18NString(h, entry);
+/*@=dependenttrans@*/
break;
default:
- rc = copyEntry(entry, type, p, c, minMem);
+ rc = copyEntry(entry, he, minMem);
break;
}
@@ -1649,55 +1493,24 @@
return ((rc == 1) ? 1 : 0);
}
-/** \ingroup header
- * Free data allocated when retrieved from header.
- * @param h header
- * @param data data (or NULL)
- * @param type type of data (or -1 to force free)
- * @return NULL always
- */
-static /*@null@*/ void * headerFreeTag(/*@unused@*/ Header h,
- /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
- /*@modifies data @*/
-{
- if (data) {
- if (type == -1 ||
- type == RPM_STRING_ARRAY_TYPE ||
- type == RPM_I18NSTRING_TYPE ||
- type == RPM_BIN_TYPE)
- data = _free(data);
- }
- return NULL;
-}
-
-/** \ingroup header
- * Retrieve tag value.
- * Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements with
- * RPM_I18NSTRING_TYPE equivalent entries are translated (if HEADER_I18NTABLE
- * entry is present).
- *
- * @param h header
- * @param tag tag
- * @retval *type tag value data type (or NULL)
- * @retval *p pointer to tag value(s) (or NULL)
- * @retval *c number of values (or NULL)
- * @return 1 on success, 0 on failure
- */
-static
-int headerGetEntry(Header h, rpmTag tag,
- /*@null@*/ /*@out@*/ rpmTagType * type,
- /*@null@*/ /*@out@*/ rpmTagData * p,
- /*@null@*/ /*@out@*/ rpmTagCount * c)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
+int headerGetEntry(Header h, rpmTag tag, rpmTagType * type,
+ rpmTagData * p, rpmTagCount * c)
{
+ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
void * sw;
int rc;
if ((sw = headerGetStats(h, 19)) != NULL) /* RPMTS_OP_HDRGET */
(void) rpmswEnter(sw, 0);
- rc = intGetEntry(h, tag, (rpmTagType *)type, (rpmTagData *)p, (rpmTagCount *)c, 0);
+ he->tag = tag;
+ rc = intGetEntry(h, he, 0);
if (sw != NULL) (void) rpmswExit(sw, 0);
+ if (type)
+ *type = he->t;
+ if (p)
+ (*p).ptr = he->p.ptr;
+ if (c)
+ *c = he->c;
return rc;
}
@@ -1764,32 +1577,29 @@
* headerAddI18NString() instead.
*
* @param h header
- * @param tag tag
- * @param type tag value data type
- * @param p pointer to tag value(s)
- * @param c number of values
+ * @param he tag container
* @return 1 on success, 0 on failure
*/
static
-int headerAddEntry(Header h, rpmTag tag, rpmTagType type, const void * p, rpmTagCount c)
+int headerAddEntry(Header h, HE_t he)
/*@modifies h @*/
{
indexEntry entry;
- rpmTagData q = { .ptr = (void *) p };
+ rpmTagData q = { .ptr = he->p.ptr };
rpmTagData data;
size_t length;
/* Count must always be >= 1 for headerAddEntry. */
- if (c == 0)
+ if (he->c == 0)
return 0;
- if (hdrchkType(type))
+ if (hdrchkType(he->t))
return 0;
- if (hdrchkData(c))
+ if (hdrchkData(he->c))
return 0;
length = 0;
- data.ptr = grabData(type, &q, c, &length);
+ data.ptr = grabData(he->t, &q, he->c, &length);
if (data.ptr == NULL || length == 0)
return 0;
@@ -1801,14 +1611,14 @@
/* Fill in the index */
entry = h->index + h->indexUsed;
- entry->info.tag = tag;
- entry->info.type = type;
- entry->info.count = c;
+ entry->info.tag = he->tag;
+ entry->info.type = he->t;
+ entry->info.count = he->c;
entry->info.offset = 0;
entry->data = data.ptr;
entry->length = length;
- if (h->indexUsed > 0 && tag < h->index[h->indexUsed-1].info.tag)
+ if (h->indexUsed > 0 && he->tag < h->index[h->indexUsed-1].info.tag)
h->flags &= ~HEADERFLAG_SORTED;
h->indexUsed++;
@@ -1821,33 +1631,29 @@
* RPM_STRING_TYPE.
*
* @param h header
- * @param tag tag
- * @param type tag value data type
- * @param p pointer to tag value(s)
- * @param c number of values
+ * @param he tag container
* @return 1 on success, 0 on failure
*/
static
-int headerAppendEntry(Header h, rpmTag tag, rpmTagType type,
- const void * p, rpmTagCount c)
+int headerAppendEntry(Header h, HE_t he)
/*@modifies h @*/
{
- rpmTagData src = { .ptr = (void *) p };
+ rpmTagData src = { .ptr = he->p.ptr };
rpmTagData dest = { .ptr = NULL };
indexEntry entry;
size_t length;
- if (type == RPM_STRING_TYPE || type == RPM_I18NSTRING_TYPE) {
+ if (he->t == RPM_STRING_TYPE || he->t == RPM_I18NSTRING_TYPE) {
/* we can't do this */
return 0;
}
/* Find the tag entry in the header. */
- entry = findEntry(h, tag, type);
+ entry = findEntry(h, he->tag, he->t);
if (!entry)
return 0;
- length = dataLength(type, &src, c, 0, NULL);
+ length = dataLength(he->t, &src, he->c, 0, NULL);
if (length == 0)
return 0;
@@ -1860,11 +1666,11 @@
entry->data = xrealloc(entry->data, entry->length + length);
dest.ptr = ((char *) entry->data) + entry->length;
- copyData(type, &dest, &src, c, length);
+ copyData(he->t, &dest, &src, he->c, length);
entry->length += length;
- entry->info.count += c;
+ entry->info.count += he->c;
return 1;
}
@@ -1872,47 +1678,22 @@
/** \ingroup header
* Add or append element to tag array in header.
* @param h header
- * @param tag tag
- * @param type tag value data type
- * @param p pointer to tag value(s)
- * @param c number of values
+ * @param he tag container
* @return 1 on success, 0 on failure
*/
static
-int headerAddOrAppendEntry(Header h, rpmTag tag, rpmTagType type,
- const void * p, rpmTagCount c)
+int headerAddOrAppendEntry(Header h, HE_t he)
/*@modifies h @*/
{
- return (findEntry(h, tag, type)
- ? headerAppendEntry(h, tag, type, p, c)
- : headerAddEntry(h, tag, type, p, c));
+ return (findEntry(h, he->tag, he->t)
+ ? headerAppendEntry(h, he)
+ : headerAddEntry(h, he));
}
-/** \ingroup header
- * Add locale specific tag to header.
- * A NULL lang is interpreted as the C locale. Here are the rules:
- * \verbatim
- * - If the tag isn't in the header, it's added with the passed string
- * as new value.
- * - If the tag occurs multiple times in entry, which tag is affected
- * by the operation is undefined.
- * - If the tag is in the header w/ this language, the entry is
- * *replaced* (like headerModifyEntry()).
- * \endverbatim
- * This function is intended to just "do the right thing". If you need
- * more fine grained control use headerAddEntry() and headerModifyEntry().
- *
- * @param h header
- * @param tag tag
- * @param string tag value
- * @param lang locale
- * @return 1 on success, 0 on failure
- */
-static
int headerAddI18NString(Header h, rpmTag tag, const char * string,
const char * lang)
- /*@modifies h @*/
{
+ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
indexEntry table, entry;
rpmTagData p;
size_t length;
@@ -1920,6 +1701,7 @@
uint32_t i;
uint32_t langNum;
char * buf;
+ int xx;
table = findEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE);
entry = findEntry(h, tag, RPM_I18NSTRING_TYPE);
@@ -1941,10 +1723,14 @@
/*@=observertrans =readonlytrans@*/
p.argv[count++] = lang;
}
- if (!headerAddEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE,
- p.ptr, count))
+ he->tag = HEADER_I18NTABLE;
+ he->t = RPM_STRING_ARRAY_TYPE;
+ he->p.ptr = p.ptr;
+ he->c = count;
+ xx = headerAddEntry(h, he);
+ if (!xx)
return 0;
- table = findEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE);
+ table = findEntry(h, he->tag, he->t);
}
if (!table)
@@ -1979,7 +1765,11 @@
p.argv[i] = "";
/*@=observertrans =readonlytrans@*/
p.argv[langNum] = string;
- return headerAddEntry(h, tag, RPM_I18NSTRING_TYPE, p.ptr, langNum + 1);
+ he->tag = tag;
+ he->t = RPM_I18NSTRING_TYPE;
+ he->p.ptr = p.ptr;
+ he->c = langNum + 1;
+ return headerAddEntry(h, he);
} else if (langNum >= entry->info.count) {
ghosts = langNum - entry->info.count;
@@ -2048,43 +1838,39 @@
* Modify tag in header.
* If there are multiple entries with this tag, the first one gets replaced.
* @param h header
- * @param tag tag
- * @param type tag value data type
- * @param p pointer to tag value(s)
- * @param c number of values
+ * @param he tag container
* @return 1 on success, 0 on failure
*/
static
-int headerModifyEntry(Header h, rpmTag tag, rpmTagType type,
- const void * p, rpmTagCount c)
+int headerModifyEntry(Header h, HE_t he)
/*@modifies h @*/
{
indexEntry entry;
- rpmTagData q = { .ptr = (void *) p };
+ rpmTagData q = { .ptr = he->p.ptr };
rpmTagData oldData;
rpmTagData newData;
size_t length;
/* First find the tag */
- entry = findEntry(h, tag, type);
+ entry = findEntry(h, he->tag, he->t);
if (!entry)
return 0;
length = 0;
- newData.ptr = grabData(type, &q, c, &length);
+ newData.ptr = grabData(he->t, &q, he->c, &length);
if (newData.ptr == NULL || length == 0)
return 0;
/* make sure entry points to the first occurence of this tag */
- while (entry > h->index && (entry - 1)->info.tag == tag)
+ while (entry > h->index && (entry - 1)->info.tag == he->tag)
entry--;
/* free after we've grabbed the new data in case the two are intertwined;
that's a bad idea but at least we won't break */
oldData.ptr = entry->data;
- entry->info.count = c;
- entry->info.type = type;
+ entry->info.count = he->c;
+ entry->info.type = he->t;
entry->data = newData.ptr;
entry->length = length;
@@ -2205,7 +1991,7 @@
(void) rpmswEnter(sw, 0);
he->tag = entry->info.tag;
- rc = copyEntry(entry, &he->t, &he->p, &he->c, 0);
+ rc = copyEntry(entry, he, 0);
if (rc)
rc = rpmheRealloc(he);
@@ -2215,14 +2001,7 @@
return ((rc == 1) ? 1 : 0);
}
-/** \ingroup header
- * Duplicate a header.
- * @param h header
- * @return new header instance
- */
-static /*@null@*/
Header headerCopy(Header h)
- /*@modifies h @*/
{
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
Header nh = headerNew();
@@ -2232,22 +2011,14 @@
headerNext(hi, he, 0);
he->p.ptr = _free(he->p.ptr))
{
- if (he->p.ptr) (void) headerAddEntry(nh, he->tag, he->t, he->p.ptr, he->c);
+ if (he->p.ptr) (void) headerAddEntry(nh, he);
}
hi = headerFini(hi);
return headerReload(nh, HEADER_IMAGE);
}
-/** \ingroup header
- * Duplicate tag values from one header into another.
- * @param headerFrom source header
- * @param headerTo destination header
- * @param tagstocopy array of tags that are copied
- */
-static
void headerCopyTags(Header headerFrom, Header headerTo, rpmTag * tagstocopy)
- /*@modifies headerTo @*/
{
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
rpmTag * tagno;
@@ -2267,46 +2038,6 @@
}
}
-/*@observer@*/ /*@unchecked@*/
-static struct HV_s hdrVec1 = {
- headerLink,
- headerUnlink,
- headerFree,
- headerNew,
- headerSort,
- headerUnsort,
- headerSizeof,
- headerUnload,
- headerReload,
- headerCopy,
- headerLoad,
- headerCopyLoad,
- headerIsEntry,
- headerFreeTag,
- headerGetEntry,
- headerAddEntry,
- headerAppendEntry,
- headerAddOrAppendEntry,
- headerAddI18NString,
- headerModifyEntry,
- headerRemoveEntry,
- headerCopyTags,
- headerGetMagic,
- headerSetMagic,
- headerGetOrigin,
- headerSetOrigin,
- headerGetInstance,
- headerSetInstance,
- headerGetStats,
- NULL, NULL,
- 1
-};
-
-/*@-compmempass -redef@*/
-/*@observer@*/ /*@unchecked@*/
-HV_t hdrVec = &hdrVec1;
-/*@=compmempass =redef@*/
-
int headerGet(Header h, HE_t he, /*@unused@*/ unsigned int flags)
{
void * sw;
@@ -2342,7 +2073,7 @@
rc = ext->u.tagFunction(h, he);
rc = (rc == 0); /* XXX invert extension return. */
} else
- rc = intGetEntry(h, he->tag, &he->t, &he->p, &he->c, 0);
+ rc = intGetEntry(h, he, 0);
if (rc)
rc = rpmheRealloc(he);
@@ -2378,9 +2109,9 @@
#endif
if (he->append)
- rc = headerAddOrAppendEntry(h, he->tag, he->t, he->p.ptr, he->c);
+ rc = headerAddOrAppendEntry(h, he);
else
- rc = headerAddEntry(h, he->tag, he->t, he->p.ptr, he->c);
+ rc = headerAddEntry(h, he);
return rc;
}
@@ -2402,5 +2133,5 @@
/*@=modfilesys@*/
#endif
- return headerModifyEntry(h, he->tag, he->t, he->p.ptr, he->c);
+ return headerModifyEntry(h, he);
}
@@ .
rm -f rpm/rpmdb/header.h <<'@@ .'
Index: rpm/rpmdb/header.h
============================================================================
[NO CHANGE SUMMARY BECAUSE FILE AS A WHOLE IS JUST REMOVED]
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/header_internal.h
============================================================================
$ cvs diff -u -r1.36 -r1.37 header_internal.h
--- rpm/rpmdb/header_internal.h 24 Nov 2007 21:01:45 -0000 1.36
+++ rpm/rpmdb/header_internal.h 26 Nov 2007 05:16:52 -0000 1.37
@@ -5,7 +5,7 @@
* \file rpmdb/header_internal.h
*/
-#include <header.h>
+#include <rpmtag.h>
#if !defined(__LCLINT__)
#include <netinet/in.h>
@@ -82,8 +82,6 @@
* The Header data structure.
*/
struct headerToken_s {
-/*@unused@*/
- struct HV_s hv; /*!< Header public methods. */
unsigned char magic[8]; /*!< Header magic. */
/*@only@*/ /*@null@*/
void * blob; /*!< Header region blob. */
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/librpmdb.vers
============================================================================
$ cvs diff -u -r1.34 -r1.35 librpmdb.vers
--- rpm/rpmdb/librpmdb.vers 26 Nov 2007 02:03:10 -0000 1.34
+++ rpm/rpmdb/librpmdb.vers 26 Nov 2007 05:16:52 -0000 1.35
@@ -26,22 +26,35 @@
_hdr_getops;
_hdr_loadops;
_hdr_stats;
- hdrVec;
+ headerAddI18NString;
headerCheck;
headerCompoundFormats;
+ headerCopyLoad;
+ headerCopyTags;
headerDefaultFormats;
headerDel;
headerFini;
+ headerFree;
headerGet;
+ headerGetEntry;
+ headerGetInstance;
+ headerGetMagic;
+ headerGetOrigin;
headerInit;
+ headerIsEntry;
+ headerLink;
headerMacrosLoad;
headerMacrosUnload;
headerMergeLegacySigs;
headerMod;
headerNEVRA;
+ headerNew;
headerNext;
headerPut;
headerRegenSigHeader;
+ headerReload;
+ headerSetInstance;
+ headerSizeof;
headerSprintf;
headerVerifyInfo;
hGetColor;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/rpmtag.h
============================================================================
$ cvs diff -u -r1.15 -r1.16 rpmtag.h
--- rpm/rpmdb/rpmtag.h 26 Nov 2007 02:03:10 -0000 1.15
+++ rpm/rpmdb/rpmtag.h 26 Nov 2007 05:16:52 -0000 1.16
@@ -5,6 +5,8 @@
* \file rpmdb/rpmtag.h
*/
+#include <rpmsw.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -723,6 +725,282 @@
int headerNext(HeaderIterator hi, HE_t he, /*@unused@*/ unsigned int flags)
/*@modifies hi, he @*/;
+/** \ingroup header
+ * Reference a header instance.
+ * @param h header
+ * @return referenced header instance
+ */
+Header headerLink(Header h)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * Dereference a header instance.
+ * @param h header
+ * @return NULL always
+ */
+Header headerUnlink(/*@killref@*/ /*@null@*/ Header h)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * Dereference a header instance.
+ * @param h header
+ * @return NULL always
+ */
+/*@null@*/
+Header headerFree(/*@killref@*/ /*@null@*/ Header h)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * Create new (empty) header instance.
+ * @return header
+ */
+Header headerNew(void)
+ /*@*/;
+
+/** \ingroup header
+ * Return size of on-disk header representation in bytes.
+ * @param h header
+ * @return size of on-disk header
+ */
+size_t headerSizeof(/*@null@*/ Header h)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * @param h header
+ * @retval *lenp no. bytes in unloaded header blob
+ * @return unloaded header blob (NULL on error)
+ */
+/*@only@*/ /*@null@*/
+void * headerUnload(Header h, /*@out@*/ /*@null@*/ size_t * lenp)
+ /*@modifies h, *lenp @*/;
+
+/** \ingroup header
+ * Convert header to on-disk representation, and then reload.
+ * This is used to insure that all header data is in one chunk.
+ * @param h header (with pointers)
+ * @param tag region tag
+ * @return on-disk header (with offsets)
+ */
+/*@null@*/
+Header headerReload(/*@only@*/ Header h, int tag)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * Duplicate a header.
+ * @param h header
+ * @return new header instance
+ */
+/*@null@*/
+Header headerCopy(Header h)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * Convert header to in-memory representation.
+ * @param uh on-disk header blob (i.e. with offsets)
+ * @return header
+ */
+/*@null@*/
+Header headerLoad(/*@kept@*/ void * uh)
+ /*@modifies uh @*/;
+
+/** \ingroup header
+ * Make a copy and convert header to in-memory representation.
+ * @param uh on-disk header blob (i.e. with offsets)
+ * @return header
+ */
+/*@null@*/
+Header headerCopyLoad(const void * uh)
+ /*@*/;
+
+/** \ingroup header
+ * Check if tag is in header.
+ * @param h header
+ * @param tag tag
+ * @return 1 on success, 0 on failure
+ */
+int headerIsEntry(/*@null@*/ Header h, rpmTag tag)
+ /*@*/;
+
+/** \ingroup header
+ * Retrieve tag value.
+ * @todo Eliminate.
+ * Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements with
+ * RPM_I18NSTRING_TYPE equivalent entries are translated (if HEADER_I18NTABLE
+ * entry is present).
+ *
+ * @param h header
+ * @param tag tag
+ * @retval *type tag value data type (or NULL)
+ * @retval *p pointer to tag value(s) (or NULL)
+ * @retval *c number of values (or NULL)
+ * @return 1 on success, 0 on failure
+ */
+int headerGetEntry(Header h, rpmTag tag,
+ /*@null@*/ /*@out@*/ rpmTagType * type,
+ /*@null@*/ /*@out@*/ rpmTagData * p,
+ /*@null@*/ /*@out@*/ rpmTagCount * c)
+ /*@modifies *type, *p, *c @*/;
+
+/** \ingroup header
+ * Add locale specific tag to header.
+ * A NULL lang is interpreted as the C locale. Here are the rules:
+ * \verbatim
+ * - If the tag isn't in the header, it's added with the passed string
+ * as new value.
+ * - If the tag occurs multiple times in entry, which tag is affected
+ * by the operation is undefined.
+ * - If the tag is in the header w/ this language, the entry is
+ * *replaced* (like headerModifyEntry()).
+ * \endverbatim
+ * This function is intended to just "do the right thing". If you need
+ * more fine grained control use headerAddEntry() and headerModifyEntry().
+ *
+ * @param h header
+ * @param tag tag
+ * @param string tag value
+ * @param lang locale
+ * @return 1 on success, 0 on failure
+ */
+int headerAddI18NString(Header h, rpmTag tag, const char * string,
+ const char * lang)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * Duplicate tag values from one header into another.
+ * @param headerFrom source header
+ * @param headerTo destination header
+ * @param tagstocopy array of tags that are copied
+ */
+void headerCopyTags(Header headerFrom, Header headerTo, rpmTag * tagstocopy)
+ /*@modifies headerTo @*/;
+
+/** \ingroup header
+ * Return header magic.
+ * @param h header
+ * @param *magicp magic array
+ * @param *nmagicp no. bytes of magic
+ * @return 0 always
+ */
+int headerGetMagic(/*@null@*/ Header h, unsigned char **magicp, size_t *nmagicp)
+ /*@modifies *magicp, *nmagicp @*/;
+
+/** \ingroup header
+ * Store header magic.
+ * @param h header
+ * @param magic magic array
+ * @param nmagic no. bytes of magic
+ * @return 0 always
+ */
+int headerSetMagic(/*@null@*/ Header h, unsigned char * magic, size_t nmagic)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * Return header origin (e.g path or URL).
+ * @param h header
+ * @return header origin
+ */
+/*@observer@*/ /*@null@*/
+const char * headerGetOrigin(/*@null@*/ Header h)
+ /*@*/;
+
+/** \ingroup header
+ * Store header origin (e.g path or URL).
+ * @param h header
+ * @param origin new header origin
+ * @return 0 always
+ */
+int headerSetOrigin(/*@null@*/ Header h, const char * origin)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * Return header instance (if from rpmdb).
+ * @param h header
+ * @return header instance
+ */
+uint32_t headerGetInstance(/*@null@*/ Header h)
+ /*@*/;
+
+/** \ingroup header
+ * Store header instance (e.g path or URL).
+ * @param h header
+ * @param origin new header instance
+ * @return 0 always
+ */
+uint32_t headerSetInstance(/*@null@*/ Header h, uint32_t instance)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * Return header stats accumulator structure.
+ * @param h header
+ * @param opx per-header accumulator index (aka rpmtsOpX)
+ * @return per-header accumulator pointer
+ */
+/*@null@*/
+void * headerGetStats(Header h, int opx)
+ /*@*/;
+
+/**
+ * Define per-header macros.
+ * @param h header
+ * @return 0 always
+ */
+int headerMacrosLoad(Header h)
+ /*@globals internalState @*/
+ /*@modifies internalState @*/;
+
+/**
+ * Define per-header macros.
+ * @param h header
+ * @return 0 always
+ */
+int headerMacrosUnload(Header h)
+ /*@globals internalState @*/
+ /*@modifies internalState @*/;
+
+/** \ingroup header
+ * Return name, epoch, version, release, arch strings from header.
+ * @param h header
+ * @retval *np name pointer (or NULL)
+ * @retval *ep epoch pointer (or NULL)
+ * @retval *vp version pointer (or NULL)
+ * @retval *rp release pointer (or NULL)
+ * @retval *ap arch pointer (or NULL)
+ * @return 0 always
+ */
+int headerNEVRA(Header h,
+ /*@null@*/ /*@out@*/ const char ** np,
+ /*@null@*/ /*@out@*/ /*@unused@*/ const char ** ep,
+ /*@null@*/ /*@out@*/ const char ** vp,
+ /*@null@*/ /*@out@*/ const char ** rp,
+ /*@null@*/ /*@out@*/ const char ** ap)
+ /*@modifies h, *np, *vp, *rp, *ap @*/;
+
+/**
+ * Return header color.
+ * @param h header
+ * @return header color
+ */
+uint32_t hGetColor(Header h)
+ /*@modifies h @*/;
+
+/** \ingroup header
+ * Translate and merge legacy signature tags into header.
+ * @todo Remove headerSort() through headerInitIterator() modifies sig.
+ * @param h header
+ * @param sigh signature header
+ */
+void headerMergeLegacySigs(Header h, const Header sigh)
+ /*@modifies h, sigh @*/;
+
+/** \ingroup header
+ * Regenerate signature header.
+ * @todo Remove headerSort() through headerInitIterator() modifies h.
+ * @param h header
+ * @param noArchiveSize don't copy archive size tag (pre rpm-4.1)
+ * @return regenerated signature header
+ */
+Header headerRegenSigHeader(const Header h, int noArchiveSize)
+ /*@modifies h @*/;
#ifdef __cplusplus
}
#endif
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/signature.h
============================================================================
$ cvs diff -u -r1.3 -r1.4 signature.h
--- rpm/rpmdb/signature.h 4 Nov 2007 17:59:56 -0000 1.3
+++ rpm/rpmdb/signature.h 26 Nov 2007 05:16:52 -0000 1.4
@@ -6,8 +6,6 @@
* Generate and verify rpm package signatures.
*/
-#include <header.h>
-
/** \ingroup signature
* Identify PGP versions.
* @note Greater than 0 is a valid PGP version.
@@ .
patch -p0 <<'@@ .'
Index: rpm/tools/rpm2cpio.c
============================================================================
$ cvs diff -u -r2.2 -r2.3 rpm2cpio.c
--- rpm/tools/rpm2cpio.c 24 Nov 2007 22:07:31 -0000 2.2
+++ rpm/tools/rpm2cpio.c 26 Nov 2007 05:16:53 -0000 2.3
@@ -5,7 +5,6 @@
#include <rpmio.h>
#include <rpmcb.h> /* XXX fnpyKey */
-#include <header.h>
#include <rpmlib.h>
#include <rpmts.h>
@@ .
patch -p0 <<'@@ .'
Index: rpm/tools/rpmcache.c
============================================================================
$ cvs diff -u -r2.26 -r2.27 rpmcache.c
--- rpm/tools/rpmcache.c 24 Nov 2007 23:15:33 -0000 2.26
+++ rpm/tools/rpmcache.c 26 Nov 2007 05:16:53 -0000 2.27
@@ -9,7 +9,6 @@
#include <fts.h>
#include <rpmio.h>
-#include <header.h>
#include <rpmcli.h>
#define _RPMGI_INTERNAL
@@ .
Received on Mon Nov 26 06:16:54 2007