revert buildtime tie breaking, not the right thing to do.

splint fiddles.

CVS patchset: 7216
CVS date: 2004/04/01 12:56:54
This commit is contained in:
jbj 2004-04-01 12:56:54 +00:00
parent 34daf7ced8
commit 0d73d4699b
10 changed files with 49 additions and 54 deletions

View File

@ -78,8 +78,8 @@ static int intcmp(const void * a, const void * b)
*/
static int removePackage(rpmts ts, Header h, int dboffset,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey depends)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem @*/
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/
{
rpmte p;

View File

@ -921,9 +921,9 @@ static int recontextsTag(Header h, /*@out@*/ rpmTagType * type,
static int fileprovideTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies h, *type, *data, *count, *freeData,
rpmGlobalMacroContext, fileSystem @*/
rpmGlobalMacroContext, fileSystem, internalState @*/
/*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
/\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
{
@ -945,9 +945,9 @@ static int fileprovideTag(Header h, /*@out@*/ rpmTagType * type,
static int filerequireTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies h, *type, *data, *count, *freeData,
rpmGlobalMacroContext, fileSystem @*/
rpmGlobalMacroContext, fileSystem, internalState @*/
/*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
/\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
{

View File

@ -62,8 +62,7 @@ int rpmVersionCompare(Header first, Header second)
{
const char * one, * two;
int_32 * epochOne, * epochTwo;
int_32 * btOne, * btTwo;
int rc = 0;
int rc;
if (!headerGetEntry(first, RPMTAG_EPOCH, NULL, (void **) &epochOne, NULL))
epochOne = NULL;
@ -71,19 +70,17 @@ int rpmVersionCompare(Header first, Header second)
epochTwo = NULL;
if (epochOne != NULL && epochTwo == NULL)
rc = 1;
return 1;
else if (epochOne == NULL && epochTwo != NULL)
rc = -1;
return -1;
else if (epochOne != NULL && epochTwo != NULL) {
/*@-boundsread@*/
if (*epochOne < *epochTwo)
rc = -1;
return -1;
else if (*epochOne > *epochTwo)
rc = 1;
return 1;
/*@=boundsread@*/
}
if (rc)
return rc;
rc = headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL);
rc = headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL);
@ -95,22 +92,7 @@ int rpmVersionCompare(Header first, Header second)
rc = headerGetEntry(first, RPMTAG_RELEASE, NULL, (void **) &one, NULL);
rc = headerGetEntry(second, RPMTAG_RELEASE, NULL, (void **) &two, NULL);
rc = rpmvercmp(one, two);
if (rc)
return rc;
if (!headerGetEntry(first, RPMTAG_BUILDTIME, NULL, (void **) &btOne, NULL))
btOne = NULL;
if (!headerGetEntry(second, RPMTAG_BUILDTIME, NULL, (void **) &btTwo, NULL))
btTwo = NULL;
if (btOne != NULL && btTwo != NULL && *btOne > 0 && *btTwo > 0) {
/*@-boundsread@*/
rc = (*btOne < *btTwo ? -1 : (*btOne == *btTwo ? 0 : -1));
/*@=boundsread@*/
}
return rc;
return rpmvercmp(one, two);
}
/**

View File

@ -123,7 +123,8 @@ static const char * beehiveToken = "redhatbuilddependency";
* @returns 0 == false, 1 == true
*/
static int archFilter(const char * arch)
/*@*/
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
{
static int oneshot = 0;
int negate = 0; /* assume no negation. */
@ -173,16 +174,18 @@ fprintf(stderr, "=== archScore(\"%s\") %d negate %d rc %d\n", arch, archScore, n
* @param token namespace string
* @returns filtered dependency set
*/
static rpmds rpmdsFilter(/*@returned@*/ rpmds ds,
/*@null@*/
static rpmds rpmdsFilter(/*@null@*/ /*@returned@*/ rpmds ds,
/*@null@*/ const char * token)
/*@modifies ds @*/
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ds, rpmGlobalMacroContext, fileSystem, internalState @*/
{
size_t toklen;
rpmds fds;
int i;
if (ds == NULL || token == NULL || *token == '\0')
return ds;
goto exit;
toklen = strlen(token);
fds = rpmdsLink(ds, ds->Type);
@ -227,6 +230,7 @@ fprintf(stderr, "*** f \"%s\"\n", f);
nb = sizeof(buf) - 1;
(void) strncpy(buf, g, nb);
buf[nb] = '\0';
/*@-branchstate@*/
switch (state) {
case 0: /* g is unwrapped N */
gN = xstrdup(buf);
@ -237,6 +241,7 @@ fprintf(stderr, "*** f \"%s\"\n", f);
ignore = 0;
/*@switchbreak@*/ break;
}
/*@=branchstate@*/
state++;
}
if (ignore) {
@ -246,15 +251,19 @@ if (_rpmds_debug < 0)
fprintf(stderr, "*** deleting N[%d:%d] = \"%s\"\n", i, Count, N);
/*@=modfilesys@*/
if (i < (Count - 1)) {
memcpy((fds->N + i), (fds->N + i + 1), (Count - (i+1)) * sizeof(*fds->N));
memcpy((fds->EVR + i), (fds->EVR + i + 1), (Count - (i+1)) * sizeof(*fds->EVR));
memcpy((fds->Flags + i), (fds->Flags + i + 1), (Count - (i+1)) * sizeof(*fds->Flags));
memmove((fds->N + i), (fds->N + i + 1), (Count - (i+1)) * sizeof(*fds->N));
if (fds->EVR != NULL)
memmove((fds->EVR + i), (fds->EVR + i + 1), (Count - (i+1)) * sizeof(*fds->EVR));
if (fds->Flags != NULL)
memmove((fds->Flags + i), (fds->Flags + i + 1), (Count - (i+1)) * sizeof(*fds->Flags));
fds->i--;
}
fds->Count--;
} else if (gN != NULL) {
/*@-modobserver -observertrans@*/
char * t = (char *) N;
strcpy(t, gN);
(void) strcpy(t, gN);
/*@=modobserver =observertrans@*/
/*@-modfilesys@*/
if (_rpmds_debug < 0)
fprintf(stderr, "*** unwrapping N[%d] = \"%s\"\n", i, N);
@ -264,7 +273,10 @@ fprintf(stderr, "*** unwrapping N[%d] = \"%s\"\n", i, N);
}
fds = rpmdsFree(fds);
exit:
/*@-refcounttrans@*/
return ds;
/*@=refcounttrans@*/
}
rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
@ -1063,11 +1075,8 @@ int rpmdsCompare(const rpmds A, const rpmds B)
if (sense == 0) {
sense = rpmvercmp(aV, bV);
if (sense == 0 && aR && *aR && bR && *bR) {
if (sense == 0 && aR && *aR && bR && *bR)
sense = rpmvercmp(aR, bR);
if (sense == 0 && A->BT > 0 && B->BT > 0)
sense = (A->BT < B->BT ? -1 : (A->BT == B->BT ? 0 : -1));
}
}
/*@=boundsread@*/
aEVR = _free(aEVR);

View File

@ -115,7 +115,8 @@ rpmds rpmdsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds)
*/
/*@null@*/
rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
/*@modifies h @*/;
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
/**
* Return new formatted dependency string.
@ -372,7 +373,8 @@ void rpmdsProblem(/*@null@*/ rpmps ps, const char * pkgNEVR, const rpmds ds,
* @return 1 if any dependency overlaps, 0 otherwise
*/
int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
/*@modifies h @*/;
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
/**
* Compare package name-version-release from header with a single dependency.

View File

@ -578,8 +578,9 @@ void rpmfiBuildREContexts(Header h,
*/
void rpmfiBuildFDeps(Header h, rpmTag tagN,
/*@out@*/ const char *** fdepsp, /*@out@*/ int * fcp)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
/*@modifies h, *fdepsp, *fcp, rpmGlobalMacroContext, fileSystem @*/;
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies h, *fdepsp, *fcp,
rpmGlobalMacroContext, fileSystem, internalState @*/;
/**
* Return file type from mode_t.

View File

@ -493,12 +493,12 @@ typedef enum rpmsenseFlags_e {
RPMSENSE_TRIGGERIN = (1 << 16), /*!< %triggerin dependency. */
RPMSENSE_TRIGGERUN = (1 << 17), /*!< %triggerun dependency. */
RPMSENSE_TRIGGERPOSTUN = (1 << 18), /*!< %triggerpostun dependency. */
/* (1 << 19) unused. */
RPMSENSE_MISSINGOK = (1 << 19), /*!< suggests/enhances hint. */
RPMSENSE_SCRIPT_PREP = (1 << 20), /*!< %prep build dependency. */
RPMSENSE_SCRIPT_BUILD = (1 << 21), /*!< %build build dependency. */
RPMSENSE_SCRIPT_INSTALL = (1 << 22),/*!< %install build dependency. */
RPMSENSE_SCRIPT_CLEAN = (1 << 23), /*!< %clean build dependency. */
RPMSENSE_RPMLIB = ((1 << 24) | RPMSENSE_PREREQ), /*!< rpmlib(feature) dependency. */
RPMSENSE_RPMLIB = ((1 << 24) | RPMSENSE_PREREQ), /*!< rpmlib(feature) dependency. */
/*@-enummemuse@*/
RPMSENSE_TRIGGERPREIN = (1 << 25), /*!< @todo Implement %triggerprein. */
/*@=enummemuse@*/

View File

@ -85,8 +85,9 @@ static void delTE(rpmte p)
static void addTE(rpmts ts, rpmte p, Header h,
/*@dependent@*/ /*@null@*/ fnpyKey key,
/*@null@*/ rpmRelocation * relocs)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
/*@modifies ts, p, h, rpmGlobalMacroContext, fileSystem @*/
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, p, h,
rpmGlobalMacroContext, fileSystem, internalState @*/
{
int scareMem = 0;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;

View File

@ -172,8 +172,8 @@ rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
/*@null@*/ rpmRelocation * relocs,
int dboffset,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem @*/;
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
/**
* Retrieve type of transaction element.

View File

@ -1038,8 +1038,8 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
* @return 0 on success
*/
int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem @*/;
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
/** \ingroup rpmts
* Retrieve keys from ordered transaction set.