revert buildtime tie breaking, not the right thing to do.
authorjbj <devnull@localhost>
Thu, 1 Apr 2004 12:56:54 +0000 (12:56 +0000)
committerjbj <devnull@localhost>
Thu, 1 Apr 2004 12:56:54 +0000 (12:56 +0000)
splint fiddles.

CVS patchset: 7216
CVS date: 2004/04/01 12:56:54

lib/depends.c
lib/formats.c
lib/psm.c
lib/rpmds.c
lib/rpmds.h
lib/rpmfi.h
lib/rpmlib.h
lib/rpmte.c
lib/rpmte.h
lib/rpmts.h

index df8be9253c0f4f4aa494a4baeea62aecbd77c032..19e1a7700866c6ee3f88cfe457834d9cc3972dcf 100644 (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;
 
index 8eb21282d46d388f1bb89ed5eefbc5132dd0f4e3..5084d89f9e58fa6972a88287f5a92c2968ae6477 100644 (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 @*/
 {
index 7e6ef2de77f4aa3bc69aa23c7e570c475b4bbaf9..c521d118563caefee136f04d71aa4fc0ccdc77e7 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -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);
 }
 
 /**
index b2753ae907e4762098e5f8a16792185a88b873a6..914946626aa1f285b5efee3c7e2ae3697c16a5e8 100644 (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);
index 469284503516fa4c5b5c07d36f048c5791affa16..1ffa756ffb161f4aa5a94c9c986d385cc189385b 100644 (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.
index 3a3bf919219ae694878a6a620d8d7521de25a34e..cc56f935d6511df3e4ac7fb643473cb115c8dee3 100644 (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.
index 00d26c966a5560aa88793741a9b9a8851e3ae743..36a305fce7bd1b84505286eb14701d063e3ddb72 100644 (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@*/
index b70de699d84e3cb3fb53d398f2408676d6db237d..6429379a72a12afe8591f4a54e8c129e5ff97901 100644 (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;
index 530d651134fd6e284e5714b79e46efe3b69334c9..026b1c61b12f1700de3506b8331e81221810329c 100644 (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.
index 31cea530de918aedb9691020fc4fe5526cebce95..dc7b62c53d2c44970e375eef38a69fc9efc36495 100644 (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.