From b7129ca89835ca7819b104f38d18970004fb0064 Mon Sep 17 00:00:00 2001 From: jbj Date: Tue, 24 Dec 2002 04:04:20 +0000 Subject: [PATCH] splint fiddles. CVS patchset: 5962 CVS date: 2002/12/24 04:04:20 --- build/files.c | 5 +++-- build/pack.c | 15 +++++++-------- build/parseSpec.c | 6 +++++- build/rpmbuild.h | 19 +++++++------------ build/rpmspec.h | 2 ++ build/spec.c | 2 ++ lib/rpmfi.h | 2 +- lib/rpmts.c | 4 ++++ lib/rpmts.h | 2 ++ 9 files changed, 33 insertions(+), 24 deletions(-) diff --git a/build/files.c b/build/files.c index c7b5c77..71c7f61 100644 --- a/build/files.c +++ b/build/files.c @@ -1370,6 +1370,7 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl, fi->fgids = xcalloc(sizeof(*fi->fgids), fi->fc); /* Make the cpio list */ + if (fi->dil != NULL) /* XXX can't happen */ for (i = 0, flp = fl->fileList; i < fi->fc; i++, flp++) { char * b; @@ -1425,12 +1426,12 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl, fi->fmapflags[i] |= CPIO_FOLLOW_SYMLINKS; } - /*@-branchstate@*/ + /*@-branchstate -compdef@*/ if (fip) *fip = fi; else fi = rpmfiFree(fi); - /*@=branchstate@*/ + /*@=branchstate =compdef@*/ } } /*@=bounds@*/ diff --git a/build/pack.c b/build/pack.c index 93668f5..d092bf5 100644 --- a/build/pack.c +++ b/build/pack.c @@ -698,14 +698,13 @@ exit: /* XXX Fish the pkgid out of the signature header. */ if (sig != NULL && pkgidp != NULL) { - HGE_t hge = (HGE_t)headerGetEntry; - unsigned char * md5 = NULL; - rpmTagType type; + int_32 tagType; + unsigned char * MD5 = NULL; int_32 c; int xx; - xx = hge(sig, RPMSIGTAG_MD5, &type, (void **)&md5, &c); - if (type == RPM_BIN_TYPE && md5 != NULL && c == 16) - *pkgidp = md5; + xx = headerGetEntry(sig, RPMSIGTAG_MD5, &tagType, (void **)&MD5, &c); + if (tagType == RPM_BIN_TYPE && MD5 != NULL && c == 16) + *pkgidp = MD5; } sig = rpmFreeSignature(sig); @@ -834,7 +833,7 @@ int packageBinaries(Spec spec) rc = writeRPM(&pkg->header, NULL, fn, RPMLEAD_BINARY, csa, spec->passPhrase, NULL); - csa->cpioList = rpmfiFree(pkg->cpioList); + csa->cpioList = rpmfiFree(csa->cpioList); csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageBinaries)"); /*@=type@*/ fn = _free(fn); @@ -880,7 +879,7 @@ int packageSources(Spec spec) rc = writeRPM(&spec->sourceHeader, &spec->sourcePkgId, fn, RPMLEAD_SOURCE, csa, spec->passPhrase, &(spec->cookie)); - csa->cpioList = rpmfiFree(spec->sourceCpioList); + csa->cpioList = rpmfiFree(csa->cpioList); csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageSources)"); /*@=type@*/ fn = _free(fn); diff --git a/build/parseSpec.c b/build/parseSpec.c index fda62e0..305d81e 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -525,8 +525,10 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootURL, || (spec->BASpecs[index] = rpmtsSetSpec(ts, NULL)) == NULL) { spec->BACount = index; +/*@-nullstate@*/ spec = freeSpec(spec); return RPMERR_BADSPEC; +/*@=nullstate@*/ } #ifdef DYING rpmSetMachine(saveArch, NULL); @@ -539,10 +541,12 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootURL, spec->BACount = index; if (! index) { - spec = freeSpec(spec); rpmError(RPMERR_BADSPEC, _("No compatible architectures found for build\n")); +/*@-nullstate@*/ + spec = freeSpec(spec); return RPMERR_BADSPEC; +/*@=nullstate@*/ } /* diff --git a/build/rpmbuild.h b/build/rpmbuild.h index d1dd71c..abe994d 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -471,10 +471,8 @@ int parseSpec(rpmts ts, const char * specFile, /*@null@*/ const char * passPhrase, /*@null@*/ char * cookie, int anyarch, int force) - /*@globals rpmGlobalMacroContext, - fileSystem, internalState @*/ - /*@modifies *specp, - rpmGlobalMacroContext, fileSystem, internalState @*/; + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; /** \ingroup rpmbuild * Build stages state machine driver. @@ -484,8 +482,7 @@ int parseSpec(rpmts ts, const char * specFile, * @return 0 on success */ int buildSpec(Spec spec, int what, int test) - /*@globals rpmGlobalMacroContext, - fileSystem, internalState @*/ + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie, spec->sourceRpmName, spec->sourcePkgId, spec->macros, spec->BASpecs, @@ -500,9 +497,8 @@ int buildSpec(Spec spec, int what, int test) * @return 0 on success */ int packageBinaries(Spec spec) - /*@globals rpmGlobalMacroContext, - fileSystem, internalState @*/ - /*@modifies spec->packages->header, + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies spec->packages->header, spec->packages->cpioList, spec->sourceRpmName, rpmGlobalMacroContext, fileSystem, internalState @*/; @@ -512,9 +508,8 @@ int packageBinaries(Spec spec) * @return 0 on success */ int packageSources(Spec spec) - /*@globals rpmGlobalMacroContext, - fileSystem, internalState @*/ - /*@modifies spec->sourceHeader, spec->cookie, + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList, spec->sourceRpmName, spec->sourcePkgId, rpmGlobalMacroContext, fileSystem, internalState @*/; diff --git a/build/rpmspec.h b/build/rpmspec.h index a71b698..d14ffa8 100644 --- a/build/rpmspec.h +++ b/build/rpmspec.h @@ -148,6 +148,7 @@ struct Spec_s { unsigned char * sourcePkgId; /*@refcounted@*/ Header sourceHeader; +/*@refcounted@*/ rpmfi sourceCpioList; /*@dependent@*/ /*@null@*/ MacroContext macros; @@ -175,6 +176,7 @@ struct Package_s { Header header; /*@refcounted@*/ rpmds this; +/*@refcounted@*/ rpmfi cpioList; /*@owned@*/ diff --git a/build/spec.c b/build/spec.c index e162ce0..37f9aa2 100644 --- a/build/spec.c +++ b/build/spec.c @@ -705,6 +705,7 @@ int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg) if (qva->qva_showPackage == NULL) goto exit; +/*@-branchstate@*/ /*@-mods@*/ /* FIX: make spec abstract */ if (parseSpec(ts, arg, "/", buildRoot, recursing, passPhrase, cookie, anyarch, force) @@ -715,6 +716,7 @@ int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg) goto exit; } /*@=mods@*/ +/*@=branchstate@*/ res = 0; if (specedit) { diff --git a/lib/rpmfi.h b/lib/rpmfi.h index 2ac8924..26e8da2 100644 --- a/lib/rpmfi.h +++ b/lib/rpmfi.h @@ -51,7 +51,7 @@ struct rpmfi_s { /*@only@*/ /*@null@*/ const char ** flangs; /*!< File lang(s) (from header) */ -/*@only@*/ /*?null?*/ +/*@only@*/ /*@relnull@*/ uint_32 * dil; /*!< Directory indice(s) (from header) */ /*@only@*/ /*?null?*/ const uint_32 * fflags; /*!< File flag(s) (from header) */ diff --git a/lib/rpmts.c b/lib/rpmts.c index 38606e0..b39b078 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -1103,13 +1103,17 @@ rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags) Spec rpmtsSpec(rpmts ts) { +/*@-compdef -retexpose -usereleased@*/ return ts->spec; +/*@=compdef =retexpose =usereleased@*/ } Spec rpmtsSetSpec(rpmts ts, Spec spec) { Spec ospec = ts->spec; +/*@-assignexpose -temptrans@*/ ts->spec = spec; +/*@=assignexpose =temptrans@*/ return ospec; } diff --git a/lib/rpmts.h b/lib/rpmts.h index ddcd6a4..712769e 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -741,6 +741,7 @@ rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags) * @param ts transaction set * @return spec control structure */ +/*@null@*/ Spec rpmtsSpec(rpmts ts) /*@*/; @@ -750,6 +751,7 @@ Spec rpmtsSpec(rpmts ts) * @param spec new spec control structure * @return previous spec control structure */ +/*@null@*/ Spec rpmtsSetSpec(rpmts ts, /*@null@*/ Spec spec) /*@modifies ts @*/; -- 2.7.4