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: 22-Oct-2007 01:22:57
Branch: HEAD Handle: 2007102200225402
Modified files:
rpm CHANGES
rpm/build files.c pack.c parsePreamble.c spec.c
rpm/lib psm.c rpmfi.c verify.c
rpm/python header-py.c rpmts-py.c
rpm/rpmdb hdrNVR.c hdrfmt.c hdrinline.h header.c header.h
rpmdb.c
Log:
- jbj: hmm, still segfaults, more to do.
- jbj: change headerGetEntry prototype, use headerGetExtension instead.
- jbj: fix: hae needs he->p.ptr, not he->p, as 4th arg.
Summary:
Revision Changes Path
1.1749 +3 -0 rpm/CHANGES
1.278 +3 -3 rpm/build/files.c
2.241 +6 -6 rpm/build/pack.c
2.139 +61 -18 rpm/build/parsePreamble.c
2.158 +23 -11 rpm/build/spec.c
2.250 +10 -8 rpm/lib/psm.c
2.93 +8 -8 rpm/lib/rpmfi.c
2.174 +0 -1 rpm/lib/verify.c
1.68 +9 -9 rpm/python/header-py.c
1.74 +2 -2 rpm/python/rpmts-py.c
1.21 +23 -14 rpm/rpmdb/hdrNVR.c
1.24 +15 -14 rpm/rpmdb/hdrfmt.c
1.23 +6 -10 rpm/rpmdb/hdrinline.h
1.109 +26 -26 rpm/rpmdb/header.c
1.53 +8 -8 rpm/rpmdb/header.h
1.194 +2 -2 rpm/rpmdb/rpmdb.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1748 -r1.1749 CHANGES
--- rpm/CHANGES 21 Oct 2007 03:40:47 -0000 1.1748
+++ rpm/CHANGES 21 Oct 2007 23:22:54 -0000 1.1749
@@ -1,4 +1,7 @@
4.5 -> 5.0:
+ - jbj: hmm, still segfaults, more to do.
+ - jbj: change headerGetEntry prototype, use headerGetExtension instead.
+ - jbj: fix: hae needs he->p.ptr, not he->p, as 4th arg.
- jbj: start rearranging header.h prior to moving typedefs to rpmtag.h.
- jbj: rewrite several toy routines to use HE_t instead.
- jbj: replace hRET_t with rpmTagType, avoiding "hRET_t *" issues for now.
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/files.c
============================================================================
$ cvs diff -u -r1.277 -r1.278 files.c
--- rpm/build/files.c 20 Oct 2007 05:30:20 -0000 1.277
+++ rpm/build/files.c 21 Oct 2007 23:22:54 -0000 1.278
@@ -1251,17 +1251,17 @@
he->t = RPM_INT32_TYPE;
he->p.i32p = dirIndexes;
he->c = count;
- xx = hae(h, he->tag, he->t, he->p, he->c);
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
he->tag = RPMTAG_BASENAMES;
he->t = RPM_STRING_ARRAY_TYPE;
he->p.argv = baseNames;
he->c = count;
- xx = hae(h, he->tag, he->t, he->p, he->c);
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
he->tag = RPMTAG_DIRNAMES;
he->t = RPM_STRING_ARRAY_TYPE;
he->p.argv = dirNames;
he->c = dirIndex + 1;
- xx = hae(h, he->tag, he->t, he->p, he->c);
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
}
fileNames = _free(fileNames);
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/pack.c
============================================================================
$ cvs diff -u -r2.240 -r2.241 pack.c
--- rpm/build/pack.c 19 Oct 2007 00:36:43 -0000 2.240
+++ rpm/build/pack.c 21 Oct 2007 23:22:54 -0000 2.241
@@ -531,6 +531,8 @@
int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
CSA_t csa, char *passPhrase, const char **cookie)
{
+ HGE_t hge = (HGE_t)headerGetExtension;
+ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
FD_t fd = NULL;
FD_t ifd = NULL;
int_32 count, sigtag;
@@ -811,13 +813,11 @@
/* XXX Fish the pkgid out of the signature header. */
if (sigh != NULL && pkgidp != NULL) {
- rpmTagType tagType;
- unsigned char * MD5 = NULL;
- int_32 c;
int xx;
- xx = headerGetEntry(sigh, RPMSIGTAG_MD5, &tagType, &MD5, &c);
- if (tagType == RPM_BIN_TYPE && MD5 != NULL && c == 16)
- *pkgidp = MD5;
+ he->tag = RPMSIGTAG_MD5;
+ xx = hge(sigh, he, 0);
+ if (he->t == RPM_BIN_TYPE && he->p.ptr != NULL && he->c == 16)
+ *pkgidp = he->p.ui8p; /* XXX memory leak */
}
sigh = headerFree(sigh);
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parsePreamble.c
============================================================================
$ cvs diff -u -r2.138 -r2.139 parsePreamble.c
--- rpm/build/parsePreamble.c 19 Oct 2007 00:36:43 -0000 2.138
+++ rpm/build/parsePreamble.c 21 Oct 2007 23:22:54 -0000 2.139
@@ -337,14 +337,22 @@
/*@globals rpmGlobalMacroContext, h_errno @*/
/*@modifies h, rpmGlobalMacroContext @*/
{
+ HAE_t hae = (HAE_t)headerAddEntry;
+ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
struct optionalTag *ot;
+ int xx;
for (ot = optionalTags; ot->ot_mac != NULL; ot++) {
if (!headerIsEntry(h, ot->ot_tag)) {
/*@-boundsread@*/
const char *val = rpmExpand(ot->ot_mac, NULL);
- if (val && *val != '%')
- (void) headerAddEntry(h, ot->ot_tag, RPM_STRING_TYPE, (void *)val, 1);
+ if (val && *val != '%') {
+ he->tag = ot->ot_tag;
+ he->t = RPM_STRING_TYPE;
+ he->p.str = val;
+ he->c = 1;
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
+ }
val = _free(val);
/*@=boundsread@*/
}
@@ -358,6 +366,8 @@
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
{
+ HAE_t hae = (HAE_t)headerAddEntry;
+ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
const char *fn, *Lurlfn = NULL;
struct Source *sp;
size_t iconsize = 2048; /* XXX big enuf */
@@ -416,11 +426,19 @@
goto exit;
}
- if (!strncmp(icon, "GIF", sizeof("GIF")-1))
- xx = headerAddEntry(h, RPMTAG_GIF, RPM_BIN_TYPE, icon, nb);
- else if (!strncmp(icon, "/* XPM", sizeof("/* XPM")-1))
- xx = headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, nb);
- else {
+ if (!strncmp(icon, "GIF", sizeof("GIF")-1)) {
+ he->tag = RPMTAG_GIF;
+ he->t = RPM_BIN_TYPE;
+ he->p.i8p = icon;
+ he->c = nb;
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
+ } else if (!strncmp(icon, "/* XPM", sizeof("/* XPM")-1)) {
+ he->tag = RPMTAG_XPM;
+ he->t = RPM_BIN_TYPE;
+ he->p.i8p = icon;
+ he->c = nb;
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
+ } else {
rpmlog(RPMLOG_ERR, _("Unknown icon type: %s\n"), fn);
goto exit;
}
@@ -496,6 +514,7 @@
rpmGlobalMacroContext, fileSystem, internalState @*/
{
HGE_t hge = (HGE_t)headerGetExtension;
+ HAE_t hae = (HAE_t)headerAddEntry;
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
char * field = spec->line;
char * end;
@@ -556,7 +575,11 @@
}
addMacro(spec->macros, "PACKAGE_RELEASE", NULL, field, RMIL_OLDSPEC-1);
}
- (void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
+ he->tag = tag;
+ he->t = RPM_STRING_TYPE;
+ he->p.str = field;
+ he->c = 1;
+ xx = hae(pkg->header, he->tag, he->t, he->p.ptr, he->c);
break;
case RPMTAG_GROUP:
case RPMTAG_SUMMARY:
@@ -566,10 +589,15 @@
case RPMTAG_VENDOR:
case RPMTAG_LICENSE:
case RPMTAG_PACKAGER:
- if (!*lang)
- (void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
- else if (!(noLang && strcmp(lang, RPMBUILD_DEFAULT_LANG)))
+ if (!*lang) {
+ he->tag = tag;
+ he->t = RPM_STRING_TYPE;
+ he->p.str = field;
+ he->c = 1;
+ xx = hae(pkg->header, he->tag, he->t, he->p.ptr, he->c);
+ } else if (!(noLang && strcmp(lang, RPMBUILD_DEFAULT_LANG))) {
(void) headerAddI18NString(pkg->header, tag, field, lang);
+ }
break;
/* XXX silently ignore BuildRoot: */
case RPMTAG_BUILDROOT:
@@ -638,7 +666,11 @@
spec->lineNum, tagName(tag), spec->line);
return RPMRC_FAIL;
}
- xx = headerAddEntry(pkg->header, tag, RPM_INT32_TYPE, &num, 1);
+ he->tag = tag;
+ he->t = RPM_INT32_TYPE;
+ he->p.i32p = #
+ he->c = 1;
+ xx = hae(pkg->header, he->tag, he->t, he->p.ptr, he->c);
break;
case RPMTAG_AUTOREQPROV:
pkg->autoReq = parseYesNo(field);
@@ -741,7 +773,11 @@
default:
macro = 0;
- (void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
+ he->tag = tag;
+ he->t = RPM_STRING_TYPE;
+ he->p.str = field;
+ he->c = 1;
+ xx = hae(pkg->header, he->tag, he->t, he->p.ptr, he->c);
break;
}
@@ -927,6 +963,9 @@
/* XXX should return rpmParseState, but RPMRC_FAIL forces int return. */
int parsePreamble(Spec spec, int initialPackage)
{
+ HGE_t hge = (HGE_t)headerGetExtension;
+ HAE_t hae = (HAE_t)headerAddEntry;
+ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
rpmParseState nextPart;
int rc, xx;
char *name, *linep;
@@ -956,13 +995,17 @@
/* Construct the package */
if (flag == PART_SUBNAME) {
- const char * mainName;
- xx = headerGetEntry(spec->packages->header, RPMTAG_NAME,
- NULL, &mainName, NULL);
- sprintf(NVR, "%s-%s", mainName, name);
+ he->tag = RPMTAG_NAME;
+ xx = hge(spec->packages->header, he, 0);
+ sprintf(NVR, "%s-%s", he->p.str, name);
+ he->p.ptr = _free(he->p.ptr);
} else
strcpy(NVR, name);
- xx = headerAddEntry(pkg->header, RPMTAG_NAME, RPM_STRING_TYPE, NVR, 1);
+ he->tag = RPMTAG_NAME;
+ he->t = RPM_STRING_TYPE;
+ he->p.str = NVR;
+ he->c = 1;
+ xx = hae(pkg->header, he->tag, he->t, he->p.ptr, he->c);
}
if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/spec.c
============================================================================
$ cvs diff -u -r2.157 -r2.158 spec.c
--- rpm/build/spec.c 11 Oct 2007 19:44:21 -0000 2.157
+++ rpm/build/spec.c 21 Oct 2007 23:22:54 -0000 2.158
@@ -67,9 +67,11 @@
/*@-boundswrite@*/
int lookupPackage(Spec spec, const char *name, int flag, /*@out@*/Package *pkg)
{
- const char *pname;
+ HGE_t hge = (HGE_t)headerGetExtension;
+ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
const char *fullName;
Package p;
+ int xx;
/* "main" package */
if (name == NULL) {
@@ -81,11 +83,13 @@
/* Construct package name */
{ char *n;
if (flag == PART_SUBNAME) {
- (void) headerGetEntry(spec->packages->header, RPMTAG_NAME,
- NULL, &pname, NULL);
- fullName = n = alloca(strlen(pname) + 1 + strlen(name) + 1);
- while (*pname != '\0') *n++ = *pname++;
+ he->tag = RPMTAG_NAME;
+ xx = hge(spec->packages->header, he, 0);
+ fullName = n = alloca(strlen(he->p.str) + 1 + strlen(name) + 1);
+ n = stpcpy(n, he->p.str);
+ he->p.ptr = _free(he->p.ptr);
*n++ = '-';
+ *n = '\0';
} else {
fullName = n = alloca(strlen(name)+1);
}
@@ -96,11 +100,13 @@
/* Locate package with fullName */
for (p = spec->packages; p != NULL; p = p->next) {
- (void) headerGetEntry(p->header, RPMTAG_NAME,
- NULL, &pname, NULL);
- if (pname && (! strcmp(fullName, pname))) {
+ he->tag = RPMTAG_NAME;
+ xx = hge(p->header, he, 0);
+ if (he->p.str && !strcmp(fullName, he->p.str)) {
+ he->p.ptr = _free(he->p.ptr);
break;
}
+ he->p.ptr = _free(he->p.ptr);
}
if (pkg)
@@ -629,11 +635,14 @@
/*@globals fileSystem @*/
/*@modifies spec->sl->sl_lines[], fileSystem @*/
{
+ HGE_t hge = (HGE_t)headerGetExtension;
+ HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
Header h;
speclines sl = spec->sl;
spectags st = spec->st;
const char * msgstr = NULL;
int i, j;
+ int xx;
if (sl == NULL || st == NULL)
return;
@@ -660,11 +669,14 @@
/*@=bounds@*/
h = NULL;
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
- const char *pkgname;
h = pkg->header;
- (void) headerGetEntry(h, RPMTAG_NAME, NULL, &pkgname, NULL);
- if (!strcmp(pkgname, fmt))
+ he->tag = RPMTAG_NAME;
+ xx = hge(h, he, 0);
+ if (!strcmp(he->p.str, fmt)) {
+ he->p.ptr = _free(he->p.ptr);
/*@innerbreak@*/ break;
+ }
+ he->p.ptr = _free(he->p.ptr);
}
if (pkg == NULL || h == NULL)
h = spec->packages->header;
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/psm.c
============================================================================
$ cvs diff -u -r2.249 -r2.250 psm.c
--- rpm/lib/psm.c 20 Oct 2007 05:42:25 -0000 2.249
+++ rpm/lib/psm.c 21 Oct 2007 23:22:55 -0000 2.250
@@ -151,9 +151,9 @@
sfi = replaced;
while ((h = rpmdbNextIterator(mi)) != NULL) {
- char * secStates;
+ rpmTagData secStates;
int modified;
- int count;
+ rpmTagCount count;
modified = 0;
@@ -164,8 +164,8 @@
num = 0;
while (sfi->otherPkg && sfi->otherPkg == prev) {
assert(sfi->otherFileNum < count);
- if (secStates[sfi->otherFileNum] != RPMFILE_STATE_REPLACED) {
- secStates[sfi->otherFileNum] = RPMFILE_STATE_REPLACED;
+ if (secStates.i8p[sfi->otherFileNum] != RPMFILE_STATE_REPLACED) {
+ secStates.i8p[sfi->otherFileNum] = RPMFILE_STATE_REPLACED;
if (modified == 0) {
/* Modified header will be rewritten. */
modified = 1;
@@ -1571,7 +1571,9 @@
/* XXX hackery to assert(!scaremem) in rpmfiNew. */
if (fi->h == NULL && fi->te && fi->te->h != NULL) fi->h = headerLink(fi->te->h);
-assert(fi->h != NULL);
+#if 0
+assert(fi->h != NULL); /* XXX install/verify have fi->h, erasures doesn't. */
+#endif
switch (stage) {
case PSM_UNKNOWN:
@@ -1842,7 +1844,7 @@
he->t = type;
he->p.ptr = (void *) ptr; /* NOCAST */
he->c = count;
- xx = hae(psm->oh, he->tag, he->t, he->p, he->c);
+ xx = hae(psm->oh, he->tag, he->t, he->p.ptr, he->c);
}
}
hi = headerFreeIterator(hi);
@@ -1906,7 +1908,7 @@
he->t = RPM_INT32_TYPE;
he->p.i32p = &tid;
he->c = 1;
- xx = hae(psm->oh, he->tag, he->t, he->p, he->c);
+ xx = hae(psm->oh, he->tag, he->t, he->p.ptr, he->c);
/* Add original header's origin (i.e. URL) */
if (origin != NULL) {
@@ -1914,7 +1916,7 @@
he->t = RPM_STRING_TYPE;
he->p.str = origin;
he->c = 1;
- xx = hae(psm->oh, he->tag, he->t, he->p, he->c);
+ xx = hae(psm->oh, he->tag, he->t, he->p.ptr, he->c);
origin = _free(origin);
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmfi.c
============================================================================
$ cvs diff -u -r2.92 -r2.93 rpmfi.c
--- rpm/lib/rpmfi.c 19 Oct 2007 00:36:44 -0000 2.92
+++ rpm/lib/rpmfi.c 21 Oct 2007 23:22:55 -0000 2.93
@@ -745,7 +745,7 @@
he->t = validType;
he->p.argv = validRelocations;
he->c = numValid;
- xx = hae(origH, he->tag, he->t, he->p, he->c);
+ xx = hae(origH, he->tag, he->t, he->p.ptr, he->c);
}
validRelocations = _free(validRelocations);
}
@@ -873,7 +873,7 @@
he->t = RPM_STRING_ARRAY_TYPE;
he->p.argv = actualRelocations;
he->c = numActual;
- xx = hae(h, he->tag, he->t, he->p, he->c);
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
}
actualRelocations = _free(actualRelocations);
@@ -1102,26 +1102,26 @@
he->tag = RPMTAG_BASENAMES;
xx = hge(h, he, 0);
he->tag = RPMTAG_ORIGBASENAMES;
- xx = hae(h, he->tag, he->t, he->p, he->c);
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
he->p.ptr = _free(he->p.ptr);
he->tag = RPMTAG_DIRNAMES;
xx = hge(h, he, 0);
he->tag = RPMTAG_ORIGDIRNAMES;
- xx = hae(h, he->tag, he->t, he->p, he->c);
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
he->p.ptr = _free(he->p.ptr);
he->tag = RPMTAG_DIRINDEXES;
xx = hge(h, he, 0);
he->tag = RPMTAG_ORIGDIRINDEXES;
- xx = hae(h, he->tag, he->t, he->p, he->c);
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
he->p.ptr = _free(he->p.ptr);
he->tag = RPMTAG_BASENAMES;
he->t = RPM_STRING_ARRAY_TYPE;
he->p.argv = baseNames;
he->c = fileCount;
- xx = hme(h, he->tag, he->t, he->p, he->c);
+ xx = hme(h, he->tag, he->t, he->p.ptr, he->c);
fi->bnl = _free(fi->bnl);
xx = hge(h, he, 0);
fi->bnl = he->p.argv;
@@ -1131,7 +1131,7 @@
he->t = RPM_STRING_ARRAY_TYPE;
he->p.argv = dirNames;
he->c = dirCount;
- xx = hme(h, he->tag, he->t, he->p, he->c);
+ xx = hme(h, he->tag, he->t, he->p.ptr, he->c);
fi->dnl = _free(fi->dnl);
xx = hge(h, he, 0);
fi->dnl = he->p.argv;
@@ -1141,7 +1141,7 @@
he->t = RPM_INT32_TYPE;
he->p.i32p = dirIndexes;
he->c = fileCount;
- xx = hme(h, he->tag, he->t, he->p, he->c);
+ xx = hme(h, he->tag, he->t, he->p.ptr, he->c);
fi->dil = _free(fi->dil);
xx = hge(h, he, 0);
fi->dil = he->p.ui32p;
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/verify.c
============================================================================
$ cvs diff -u -r2.173 -r2.174 verify.c
--- rpm/lib/verify.c 20 Oct 2007 04:55:43 -0000 2.173
+++ rpm/lib/verify.c 21 Oct 2007 23:22:55 -0000 2.174
@@ -385,7 +385,6 @@
rpmps ps;
int rc = 0; /* assume no problems */
int xx;
- int i;
rpmtsEmpty(ts);
#ifdef NOTYET
@@ .
patch -p0 <<'@@ .'
Index: rpm/python/header-py.c
============================================================================
$ cvs diff -u -r1.67 -r1.68 header-py.c
--- rpm/python/header-py.c 19 Oct 2007 00:36:46 -0000 1.67
+++ rpm/python/header-py.c 21 Oct 2007 23:22:56 -0000 1.68
@@ -1183,14 +1183,14 @@
{
Header h;
HeaderIterator hi;
- int_32 * newMatch;
- int_32 * oldMatch;
+ rpmTagData newMatch;
+ rpmTagData oldMatch;
hdrObject * hdr;
int count = 0;
int_32 tag;
- rpmTagType type;
- int_32 c;
- void * p;
+ rpmTagType t;
+ rpmTagCount c;
+ rpmTagData p;
Py_BEGIN_ALLOW_THREADS
h = headerRead(fd);
@@ -1210,7 +1210,7 @@
return 1;
}
- if (*newMatch != *oldMatch) {
+ if (*newMatch.i32p != *oldMatch.i32p) {
PyErr_SetString(pyrpmError, "match tag mismatch");
return 1;
}
@@ -1220,12 +1220,12 @@
hdr->linkList = _free(hdr->linkList);
for (hi = headerInitIterator(h);
- headerNextIterator(hi, &tag, &type, (void *) &p, &c);
- p = headerFreeData(p, type))
+ headerNextIterator(hi, &tag, &t, &p, &c);
+ p.ptr = headerFreeData(p.ptr, t))
{
/* could be dupes */
headerRemoveEntry(hdr->h, tag);
- headerAddEntry(hdr->h, tag, type, p, c);
+ headerAddEntry(hdr->h, tag, t, p.ptr, c);
}
headerFreeIterator(hi);
@@ .
patch -p0 <<'@@ .'
Index: rpm/python/rpmts-py.c
============================================================================
$ cvs diff -u -r1.73 -r1.74 rpmts-py.c
--- rpm/python/rpmts-py.c 20 Oct 2007 04:55:44 -0000 1.73
+++ rpm/python/rpmts-py.c 21 Oct 2007 23:22:56 -0000 1.74
@@ -235,9 +235,9 @@
/* Synthesize a python object for callback (if necessary). */
if (pkgObj == NULL) {
if (h) {
- const char * n = NULL;
+ rpmTagData n = { .ptr = NULL };
(void) headerGetEntry(h, RPMTAG_NAME, NULL, &n, NULL);
- pkgObj = Py_BuildValue("s", n);
+ pkgObj = Py_BuildValue("s", n.str);
} else {
pkgObj = Py_None;
Py_INCREF(pkgObj);
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/hdrNVR.c
============================================================================
$ cvs diff -u -r1.20 -r1.21 hdrNVR.c
--- rpm/rpmdb/hdrNVR.c 19 Oct 2007 00:36:47 -0000 1.20
+++ rpm/rpmdb/hdrNVR.c 21 Oct 2007 23:22:56 -0000 1.21
@@ -137,23 +137,30 @@
/*@unused@*/ const char **ep, const char **vp, const char **rp,
const char **ap)
{
- rpmTagType type;
- int count;
+ rpmTagType t;
+ rpmTagData p;
+ rpmTagCount c;
if (np) {
- if (!(headerGetEntry(h, RPMTAG_NAME, &type, np, &count)
- && type == RPM_STRING_TYPE && count == 1))
- *np = NULL;
+ if (headerGetEntry(h, RPMTAG_NAME, &t, &p, &c)
+ && t == RPM_STRING_TYPE && c == 1)
+ *np = p.str;
+ else
+ *np = NULL;
}
if (vp) {
- if (!(headerGetEntry(h, RPMTAG_VERSION, &type, vp, &count)
- && type == RPM_STRING_TYPE && count == 1))
- *vp = NULL;
+ if (headerGetEntry(h, RPMTAG_VERSION, &t, &p, &c)
+ && t == RPM_STRING_TYPE && c == 1)
+ *vp = p.str;
+ else
+ *vp = NULL;
}
if (rp) {
- if (!(headerGetEntry(h, RPMTAG_RELEASE, &type, rp, &count)
- && type == RPM_STRING_TYPE && count == 1))
- *rp = NULL;
+ if (headerGetEntry(h, RPMTAG_RELEASE, &t, &p, &c)
+ && t == RPM_STRING_TYPE && c == 1)
+ *rp = p.str;
+ else
+ *rp = NULL;
}
if (ap) {
/*@-observertrans -readonlytrans@*/
@@ -164,9 +171,11 @@
*ap = "src";
/*@=observertrans =readonlytrans@*/
else
- if (!(headerGetEntry(h, RPMTAG_ARCH, &type, ap, &count)
- && type == RPM_STRING_TYPE && count == 1))
- *ap = NULL;
+ if (headerGetEntry(h, RPMTAG_ARCH, &t, &p, &c)
+ && t == RPM_STRING_TYPE && c == 1)
+ *ap = p.str;
+ else
+ *ap = NULL;
}
return 0;
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/hdrfmt.c
============================================================================
$ cvs diff -u -r1.23 -r1.24 hdrfmt.c
--- rpm/rpmdb/hdrfmt.c 20 Oct 2007 14:09:07 -0000 1.23
+++ rpm/rpmdb/hdrfmt.c 21 Oct 2007 23:22:56 -0000 1.24
@@ -798,7 +798,7 @@
/*@modifies he @*/
{
rpmTagType ipt;
- char ** array;
+ rpmTagData array;
he->tag = RPMTAG_INSTALLPREFIX;
if (headerGetEntry(h, RPMTAG_INSTALLPREFIX, &he->t, &he->p, &he->c)) {
@@ -809,9 +809,9 @@
if (headerGetEntry(h, he->tag, &ipt, &array, &he->c)) {
he->t = RPM_STRING_TYPE;
he->c = 1;
- he->p.str = xstrdup(array[0]);
+ he->p.str = xstrdup(array.argv[0]);
he->freeData = 1;
- array = headerFreeData(array, ipt);
+ array.ptr = headerFreeData(array.ptr, ipt);
return 0;
}
return 1;
@@ -900,9 +900,10 @@
static int triggertypeTag(Header h, HE_t he)
/*@modifies he @*/
{
- int_32 * indices, * flags;
+ rpmTagData indices;
+ rpmTagData flags;
const char ** conds;
- const char ** s;
+ rpmTagData s;
int i, j, xx;
int numScripts, numNames;
@@ -920,16 +921,16 @@
he->p.argv = conds = xmalloc(sizeof(*conds) * numScripts);
for (i = 0; i < numScripts; i++) {
for (j = 0; j < numNames; j++) {
- if (indices[j] != i)
+ if (indices.i32p[j] != i)
/*@innercontinue@*/ continue;
- if (flags[j] & RPMSENSE_TRIGGERPREIN)
+ if (flags.i32p[j] & RPMSENSE_TRIGGERPREIN)
conds[i] = xstrdup("prein");
- else if (flags[j] & RPMSENSE_TRIGGERIN)
+ else if (flags.i32p[j] & RPMSENSE_TRIGGERIN)
conds[i] = xstrdup("in");
- else if (flags[j] & RPMSENSE_TRIGGERUN)
+ else if (flags.i32p[j] & RPMSENSE_TRIGGERUN)
conds[i] = xstrdup("un");
- else if (flags[j] & RPMSENSE_TRIGGERPOSTUN)
+ else if (flags.i32p[j] & RPMSENSE_TRIGGERPOSTUN)
conds[i] = xstrdup("postun");
else
conds[i] = xstrdup("");
@@ -937,7 +938,7 @@
}
}
- s = headerFreeData(s, -1);
+ s.ptr = headerFreeData(s.ptr, -1);
return 0;
}
@@ -980,15 +981,15 @@
const char * msgid;
{ const char * tn = tagName(he->tag);
- const char * n = NULL;
+ rpmTagData n = { .ptr = NULL };
char * mk;
size_t nb = sizeof("()");
int xx = headerGetEntry(h, RPMTAG_NAME, NULL, &n, NULL);
xx = 0; /* XXX keep gcc quiet */
if (tn) nb += strlen(tn);
- if (n) nb += strlen(n);
+ if (n.str) nb += strlen(n.str);
mk = alloca(nb);
- sprintf(mk, "%s(%s)", (n ? n : ""), (tn ? tn : ""));
+ sprintf(mk, "%s(%s)", (n.str ? n.str : ""), (tn ? tn : ""));
msgkey = mk;
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/hdrinline.h
============================================================================
$ cvs diff -u -r1.22 -r1.23 hdrinline.h
--- rpm/rpmdb/hdrinline.h 21 Oct 2007 00:25:24 -0000 1.22
+++ rpm/rpmdb/hdrinline.h 21 Oct 2007 23:22:56 -0000 1.23
@@ -283,7 +283,7 @@
/*@unused@*/ static inline
int headerGetEntry(Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void * p,
+ /*@null@*/ /*@out@*/ hRET_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/
{
@@ -306,7 +306,7 @@
/*@unused@*/ static inline
int headerGetEntryMinMemory(Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void * p,
+ /*@null@*/ /*@out@*/ hRET_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/
{
@@ -334,8 +334,7 @@
const void * p, rpmTagCount c)
/*@modifies h @*/
{
- hRET_t *q = (void *)&p;
- return (h2hv(h)->hdradd) (h, tag, type, *q, c);
+ return (h2hv(h)->hdradd) (h, tag, type, p, c);
}
/** \ingroup header
@@ -357,8 +356,7 @@
const void * p, rpmTagCount c)
/*@modifies h @*/
{
- hRET_t *q = (void *)&p;
- return (h2hv(h)->hdrappend) (h, tag, type, *q, c);
+ return (h2hv(h)->hdrappend) (h, tag, type, p, c);
}
/** \ingroup header
@@ -376,8 +374,7 @@
const void * p, rpmTagCount c)
/*@modifies h @*/
{
- hRET_t *q = (void *)&p;
- return (h2hv(h)->hdraddorappend) (h, tag, type, *q, c);
+ return (h2hv(h)->hdraddorappend) (h, tag, type, p, c);
}
/** \ingroup header
@@ -423,8 +420,7 @@
const void * p, rpmTagCount c)
/*@modifies h @*/
{
- hRET_t *q = (void *)&p;
- return (h2hv(h)->hdrmodify) (h, tag, type, *q, c);
+ return (h2hv(h)->hdrmodify) (h, tag, type, p, c);
}
/** \ingroup header
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/header.c
============================================================================
$ cvs diff -u -r1.108 -r1.109 header.c
--- rpm/rpmdb/header.c 21 Oct 2007 03:40:48 -0000 1.108
+++ rpm/rpmdb/header.c 21 Oct 2007 23:22:56 -0000 1.109
@@ -382,12 +382,12 @@
* @param pend pointer to end of data (or NULL)
* @return no. bytes in data, -1 on failure
*/
-static int dataLength(rpmTagType type, rpmTagData p, rpmTagCount count, int onDisk,
- /*@null@*/ rpmTagData pend)
+static int dataLength(rpmTagType type, const void * p, rpmTagCount count, int onDisk,
+ /*@null@*/ const void * pend)
/*@*/
{
- const unsigned char * s = p.ui8p;
- const unsigned char * se = pend.ui8p;
+ const unsigned char * s = p;
+ const unsigned char * se = pend;
int length = 0;
switch (type) {
@@ -417,7 +417,7 @@
}
}
} else {
- const char ** av = p.argv;
+ const char ** av = (const char **) p;
while (count--) {
/* add one for null termination */
length += strlen(*av++) + 1;
@@ -471,7 +471,7 @@
int regionid)
/*@modifies *entry, *dataStart @*/
{
- rpmTagData p, pend;
+ const void * p, * pend;
unsigned char * tprev = NULL;
unsigned char * t = NULL;
int tdel = 0;
@@ -501,8 +501,8 @@
if (dataEnd && t >= dataEnd)
return -1;
- p.ptr = ie.data;
- pend.ptr = (void *) dataEnd; /* NOCAST */
+ p = ie.data;
+ pend = dataEnd;
ie.length = dataLength(ie.info.type, p, ie.info.count, 1, pend);
if (ie.length < 0 || hdrchkData(ie.length))
return -1;
@@ -1758,7 +1758,7 @@
/*@=dependenttrans@*/
break;
default:
- rc = copyEntry(entry, type, p, c, minMem);
+ rc = copyEntry(entry, type, (*p).ptr, c, minMem);
break;
}
@@ -1981,7 +1981,7 @@
static
int headerGetEntry(Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void * p,
+ /*@null@*/ /*@out@*/ hRET_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/
/*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
@@ -2011,7 +2011,7 @@
static
int headerGetEntryMinMemory(Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void * p,
+ /*@null@*/ /*@out@*/ hRET_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/
/*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
@@ -2051,14 +2051,14 @@
/**
*/
-static void copyData(rpmTagType type, /*@out@*/ void * dstPtr, rpmTagData srcPtr,
+static void copyData(rpmTagType type, /*@out@*/ void * dstPtr, const void * srcPtr,
rpmTagCount cnt, int dataLength)
/*@modifies *dstPtr @*/
{
switch (type) {
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
- { const char ** av = srcPtr.argv;
+ { const char ** av = (const char **) srcPtr;
char * t = dstPtr;
while (cnt-- > 0 && dataLength > 0) {
@@ -2072,7 +2072,7 @@
} break;
default:
- memmove(dstPtr, srcPtr.ptr, dataLength);
+ memmove(dstPtr, srcPtr, dataLength);
break;
}
}
@@ -2087,14 +2087,14 @@
*/
/*@null@*/
static void *
-grabData(rpmTagType type, rpmTagData p, rpmTagCount c, /*@out@*/ int * lenp)
+grabData(rpmTagType type, const void * p, rpmTagCount c, /*@out@*/ int * lenp)
/*@modifies *lenp @*/
/*@requires maxSet(lenp) >= 0 @*/
{
void * data = NULL;
int length;
- length = dataLength(type, p, c, 0, (rpmTagData)NULL); /* NOCAST */
+ length = dataLength(type, p, c, 0, NULL);
if (length > 0) {
data = xmalloc(length);
copyData(type, data, p, c, length);
@@ -2120,7 +2120,7 @@
* @return 1 on success, 0 on failure
*/
static
-int headerAddEntry(Header h, int_32 tag, rpmTagType type, rpmTagData p, rpmTagCount c)
+int headerAddEntry(Header h, int_32 tag, rpmTagType type, const void * p, rpmTagCount c)
/*@modifies h @*/
{
indexEntry entry;
@@ -2179,7 +2179,7 @@
*/
static
int headerAppendEntry(Header h, int_32 tag, rpmTagType type,
- rpmTagData p, rpmTagCount c)
+ const void * p, rpmTagCount c)
/*@modifies h @*/
{
indexEntry entry;
@@ -2195,7 +2195,7 @@
if (!entry)
return 0;
- length = dataLength(type, p, c, 0, (rpmTagData)NULL); /* NOCAST */
+ length = dataLength(type, p, c, 0, NULL);
if (length < 0)
return 0;
@@ -2227,7 +2227,7 @@
*/
static
int headerAddOrAppendEntry(Header h, int_32 tag, rpmTagType type,
- rpmTagData p, rpmTagCount c)
+ const void * p, rpmTagCount c)
/*@modifies h @*/
{
return (findEntry(h, tag, type)
@@ -2288,7 +2288,7 @@
p.argv[count++] = lang;
}
if (!headerAddEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE,
- p, count))
+ p.ptr, count))
return 0;
table = findEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE);
}
@@ -2323,7 +2323,7 @@
for (i = 0; i < langNum; i++)
p.argv[i] = "";
p.argv[langNum] = string;
- return headerAddEntry(h, tag, RPM_I18NSTRING_TYPE, p, langNum + 1);
+ return headerAddEntry(h, tag, RPM_I18NSTRING_TYPE, p.ptr, langNum + 1);
} else if (langNum >= entry->info.count) {
ghosts = langNum - entry->info.count;
@@ -2400,7 +2400,7 @@
*/
static
int headerModifyEntry(Header h, int_32 tag, rpmTagType type,
- rpmTagData p, rpmTagCount c)
+ const void * p, rpmTagCount c)
/*@modifies h @*/
{
indexEntry entry;
@@ -2678,7 +2678,7 @@
headerNextIterator(hi, &he->tag, &he->t, &he->p, &he->c);
he->p.ptr = headerFreeData(he->p.ptr, he->t))
{
- if (he->p.ptr) (void) headerAddEntry(nh, he->tag, he->t, he->p, he->c);
+ if (he->p.ptr) (void) headerAddEntry(nh, he->tag, he->t, he->p.ptr, he->c);
}
hi = headerFreeIterator(hi);
@@ -4163,14 +4163,14 @@
return;
for (p = tagstocopy; *p != 0; p++) {
- hRET_t ptr;
+ rpmTagData ptr;
rpmTagType type;
rpmTagCount count;
if (headerIsEntry(headerTo, *p))
continue;
if (!headerGetEntryMinMemory(headerFrom, *p, &type, &ptr, &count))
continue;
- (void) headerAddEntry(headerTo, *p, type, ptr, count);
+ (void) headerAddEntry(headerTo, *p, type, ptr.ptr, count);
ptr.ptr = headerFreeData(ptr.ptr, type);
}
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/header.h
============================================================================
$ cvs diff -u -r1.52 -r1.53 header.h
--- rpm/rpmdb/header.h 21 Oct 2007 03:40:48 -0000 1.52
+++ rpm/rpmdb/header.h 21 Oct 2007 23:22:56 -0000 1.53
@@ -385,7 +385,7 @@
* @return 1 on success, 0 on failure
*/
typedef int (*HAE_t) (Header h, rpmTag tag, rpmTagType type,
- rpmTagData p, rpmTagCount c)
+ const void * p, rpmTagCount c)
/*@modifies h @*/;
/**
@@ -400,7 +400,7 @@
* @return 1 on success, 0 on failure
*/
typedef int (*HME_t) (Header h, rpmTag tag, rpmTagType type,
- rpmTagData p, rpmTagCount c)
+ const void * p, rpmTagCount c)
/*@modifies h @*/;
/**
@@ -601,7 +601,7 @@
typedef
int (*HDRget) (Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void * p,
+ /*@null@*/ /*@out@*/ hRET_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/;
@@ -620,7 +620,7 @@
typedef
int (*HDRgetmin) (Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void * p,
+ /*@null@*/ /*@out@*/ hRET_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/;
@@ -639,7 +639,7 @@
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRadd) (Header h, int_32 tag, rpmTagType type, hRET_t p, rpmTagCount c)
+int (*HDRadd) (Header h, int_32 tag, rpmTagType type, const void * p, rpmTagCount c)
/*@modifies h @*/;
/** \ingroup header
@@ -657,7 +657,7 @@
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRappend) (Header h, int_32 tag, rpmTagType type, hRET_t p, rpmTagCount c)
+int (*HDRappend) (Header h, int_32 tag, rpmTagType type, const void * p, rpmTagCount c)
/*@modifies h @*/;
/** \ingroup header
@@ -671,7 +671,7 @@
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRaddorappend) (Header h, int_32 tag, rpmTagType type, hRET_t p, rpmTagCount c)
+int (*HDRaddorappend) (Header h, int_32 tag, rpmTagType type, const void * p, rpmTagCount c)
/*@modifies h @*/;
/** \ingroup header
@@ -710,7 +710,7 @@
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRmodify) (Header h, int_32 tag, rpmTagType type, hRET_t p, rpmTagCount c)
+int (*HDRmodify) (Header h, int_32 tag, rpmTagType type, const void * p, rpmTagCount c)
/*@modifies h @*/;
/** \ingroup header
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/rpmdb.c
============================================================================
$ cvs diff -u -r1.193 -r1.194 rpmdb.c
--- rpm/rpmdb/rpmdb.c 20 Oct 2007 01:47:17 -0000 1.193
+++ rpm/rpmdb/rpmdb.c 21 Oct 2007 23:22:56 -0000 1.194
@@ -3135,7 +3135,7 @@
he->p.i32p = &tid;
he->c = 1;
if (!headerIsEntry(h, he->tag))
- xx = hae(h, he->tag, he->t, he->p, he->c);
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
}
/* Add the package color if not present. */
@@ -3145,7 +3145,7 @@
he->t = RPM_INT32_TYPE;
he->p.ui32p = &hcolor;
he->c = 1;
- xx = hae(h, he->tag, he->t, he->p, he->c);
+ xx = hae(h, he->tag, he->t, he->p.ptr, he->c);
}
#if defined(SUPPORT_RPMV3_BASENAMES_HACKS)
@@ .
Received on Mon Oct 22 01:22:58 2007