splint fiddles.
CVS patchset: 7216
CVS date: 2004/04/01 12:56:54
*/
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;
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 @*/
{
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 @*/
{
{
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;
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);
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);
}
/**
* @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. */
* @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);
nb = sizeof(buf) - 1;
(void) strncpy(buf, g, nb);
buf[nb] = '\0';
+/*@-branchstate@*/
switch (state) {
case 0: /* g is unwrapped N */
gN = xstrdup(buf);
ignore = 0;
/*@switchbreak@*/ break;
}
+/*@=branchstate@*/
state++;
}
if (ignore) {
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);
}
fds = rpmdsFree(fds);
+exit:
+ /*@-refcounttrans@*/
return ds;
+ /*@=refcounttrans@*/
}
rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
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);
*/
/*@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.
* @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.
*/
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.
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@*/
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;
/*@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.
* @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.