From: jbj Date: Thu, 8 Aug 2002 16:06:13 +0000 (+0000) Subject: lclint fiddles. X-Git-Tag: rpm-4.4-release~1029 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6106bdb3594e9236854f09b25f2c88c868799fda;p=platform%2Fupstream%2Frpm.git lclint fiddles. CVS patchset: 5615 CVS date: 2002/08/08 16:06:13 --- diff --git a/lib/poptALL.c b/lib/poptALL.c index 3112260..b278f22 100644 --- a/lib/poptALL.c +++ b/lib/poptALL.c @@ -95,9 +95,9 @@ static void printVersion(FILE * fp) */ /*@mayexit@*/ void rpmcliConfigured(void) - /*@globals rpmCLIMacroContext, rpmGlobalMacroContext, + /*@globals rpmcliInitialized, rpmCLIMacroContext, rpmGlobalMacroContext, fileSystem, internalState @*/ - /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext, + /*@modifies rpmcliInitialized, rpmCLIMacroContext, rpmGlobalMacroContext, fileSystem, internalState @*/ { diff --git a/lib/psm.c b/lib/psm.c index 2b36431..cf50bfe 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -43,6 +43,7 @@ /*@access rpmfi @*/ /*@access rpmte @*/ /* XXX rpmInstallSourcePackage */ +/*@access rpmts @*/ /* XXX ts->notify */ int rpmVersionCompare(Header first, Header second) { diff --git a/lib/query.c b/lib/query.c index 086b8da..e34c483 100644 --- a/lib/query.c +++ b/lib/query.c @@ -483,7 +483,7 @@ void rpmDisplayQueryTags(FILE * fp) } } -int showMatches(QVA_t qva, rpmts ts) +int rpmcliShowMatches(QVA_t qva, rpmts ts) { Header h; int ec = 0; @@ -683,7 +683,7 @@ restart: /*@loopbreak@*/ break; } if (!res) - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } break; @@ -694,7 +694,7 @@ restart: _("group %s does not contain any packages\n"), arg); res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } break; @@ -704,7 +704,7 @@ restart: rpmError(RPMERR_QUERYINFO, _("no package triggers %s\n"), arg); res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } break; @@ -729,7 +729,7 @@ restart: "pkgid", arg); res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } } break; @@ -747,7 +747,7 @@ restart: "hdrid", arg); res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } break; @@ -772,7 +772,7 @@ restart: "fileid", arg); res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } } break; @@ -802,7 +802,7 @@ restart: "tid", arg); res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } } break; @@ -812,7 +812,7 @@ restart: rpmError(RPMERR_QUERYINFO, _("no package requires %s\n"), arg); res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } break; @@ -823,7 +823,7 @@ restart: rpmError(RPMERR_QUERYINFO, _("no package provides %s\n"), arg); res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } break; } @@ -863,7 +863,7 @@ restart: } res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } fn = _free(fn); } break; @@ -896,7 +896,7 @@ restart: _("record %u could not be read\n"), recOffset); res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } } break; @@ -907,7 +907,7 @@ restart: rpmError(RPMERR_QUERYINFO, _("package %s is not installed\n"), arg); res = 1; } else { - res = showMatches(qva, ts); + res = rpmcliShowMatches(qva, ts); } break; } diff --git a/lib/rpmcli.h b/lib/rpmcli.h index 6afc5bf..4cd8505 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -298,9 +298,9 @@ extern struct poptOption rpmVerifyPoptTable[]; * @param ts transaction set * @return result of last non-zero showPackage() return */ -int showMatches(QVA_t qva, rpmts ts) - /*@globals fileSystem@*/ - /*@modifies qva, fileSystem @*/; +int rpmcliShowMatches(QVA_t qva, rpmts ts) + /*@globals rpmGlobalMacroContext, fileSystem@*/ + /*@modifies qva, rpmGlobalMacroContext, fileSystem @*/; /** \ingroup rpmcli * Display list of tags that can be used in --queryformat. @@ -545,9 +545,9 @@ struct rpmInstallArguments_s { */ int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, /*@null@*/ const char ** fileArgv) - /*@globals packagesTotal, rpmGlobalMacroContext, + /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, fileSystem, internalState@*/ - /*@modifies ts, ia, packagesTotal, rpmGlobalMacroContext, + /*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext, fileSystem, internalState @*/; /** \ingroup rpmcli @@ -594,14 +594,16 @@ typedef /*@abstract@*/ struct IDTindex_s { * @param idtx id index * @return NULL always */ -/*@null@*/ IDTX IDTXfree(/*@only@*/ /*@null@*/ IDTX idtx) +/*@null@*/ +IDTX IDTXfree(/*@only@*/ /*@null@*/ IDTX idtx) /*@modifies idtx @*/; /** * Create id index. * @return new id index */ -/*@only@*/ IDTX IDTXnew(void) +/*@only@*/ +IDTX IDTXnew(void) /*@*/; /** @@ -610,7 +612,8 @@ typedef /*@abstract@*/ struct IDTindex_s { * @param need additional no. of elements needed * @return id index (with room for "need" elements) */ -/*@only@*/ /*@null@*/ IDTX IDTXgrow(/*@only@*/ /*@null@*/ IDTX idtx, int need) +/*@only@*/ /*@null@*/ +IDTX IDTXgrow(/*@only@*/ /*@null@*/ IDTX idtx, int need) /*@modifies idtx @*/; /** @@ -618,7 +621,8 @@ typedef /*@abstract@*/ struct IDTindex_s { * @param idtx id index * @return id index */ -/*@only@*/ /*@null@*/ IDTX IDTXsort(/*@only@*/ /*@null@*/ IDTX idtx) +/*@only@*/ /*@null@*/ +IDTX IDTXsort(/*@only@*/ /*@null@*/ IDTX idtx) /*@modifies idtx @*/; /** @@ -627,7 +631,8 @@ typedef /*@abstract@*/ struct IDTindex_s { * @param tag rpm tag * @return id index */ -/*@only@*/ /*@null@*/ IDTX IDTXload(rpmts ts, rpmTag tag) +/*@only@*/ /*@null@*/ +IDTX IDTXload(rpmts ts, rpmTag tag) /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; @@ -638,8 +643,8 @@ typedef /*@abstract@*/ struct IDTindex_s { * @param tag rpm tag * @return id index */ -/*@only@*/ /*@null@*/ IDTX IDTXglob(rpmts ts, - const char * globstr, rpmTag tag) +/*@only@*/ /*@null@*/ +IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag) /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; @@ -652,8 +657,10 @@ typedef /*@abstract@*/ struct IDTindex_s { */ int rpmRollback(rpmts ts, struct rpmInstallArguments_s * ia, /*@null@*/ const char ** argv) - /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ - /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; + /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, + fileSystem, internalState @*/ + /*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext, + fileSystem, internalState @*/; /** \ingroup rpmcli */ diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 5cfeb39..a11297c 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -41,8 +41,10 @@ int rpmcliProgressTotal = 0; * @param total final */ static void printHash(const unsigned long amount, const unsigned long total) - /*@globals rpmcliHashesCurrent, rpmcliProgressCurrent, fileSystem @*/ - /*@modifies rpmcliHashesCurrent, rpmcliProgressCurrent, fileSystem @*/ + /*@globals rpmcliHashesCurrent, rpmcliHashesTotal, + rpmcliProgressCurrent, fileSystem @*/ + /*@modifies rpmcliHashesCurrent, rpmcliHashesTotal, + rpmcliProgressCurrent, fileSystem @*/ { int hashesNeeded; @@ -800,8 +802,8 @@ int rpmInstallSource(rpmts ts, const char * arg, fprintf(stdout, _("Installing %s\n"), arg); { - rpmVSFlags ovsflags; - ovsflags = rpmtsSetVSFlags(ts, (rpmtsVSFlags(ts) | RPMVSF_NEEDPAYLOAD)); + rpmVSFlags ovsflags = + rpmtsSetVSFlags(ts, (rpmtsVSFlags(ts) | RPMVSF_NEEDPAYLOAD)); rpmRC rpmrc = rpmInstallSourcePackage(ts, fd, specFilePtr, cookie); rc = (rpmrc == RPMRC_OK ? 0 : 1); ovsflags = rpmtsSetVSFlags(ts, ovsflags); @@ -1000,9 +1002,7 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag) } /** @todo Transaction handling, more, needs work. */ -int rpmRollback(rpmts ts, - /*@unused@*/ struct rpmInstallArguments_s * ia, - const char ** argv) +int rpmRollback(rpmts ts, struct rpmInstallArguments_s * ia, const char ** argv) { int ifmask= (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL|INSTALL_ERASE); unsigned thistid = 0xffffffff; @@ -1092,10 +1092,14 @@ int rpmRollback(rpmts ts, /* Install the previously erased packages for this transaction. */ while (rp != NULL && rp->val.u32 == thistid) { +/*@-nullpass@*/ /* FIX: rp->key may be NULL */ rpmMessage(RPMMESS_DEBUG, "\t+++ %s\n", rp->key); +/*@=nullpass@*/ +/*@-abstract@*/ rc = rpmtsAddInstallElement(ts, rp->h, (fnpyKey)rp->key, 0, ia->relocations); +/*@=abstract@*/ if (rc != 0) goto exit; @@ -1176,13 +1180,15 @@ int rpmRollback(rpmts ts, goto exit; /* Clean up after successful rollback. */ - if (!rpmIsDebug()) { + if (rtids && !rpmIsDebug()) { int i; + if (rtids->idt) for (i = 0; i < rtids->nidt; i++) { IDT rrp = rtids->idt + i; if (rrp->val.u32 != thistid) - continue; - (void) unlink(rrp->key); + /*@innercontinue@*/ continue; + if (rrp->key) /* XXX can't happen */ + (void) unlink(rrp->key); } } diff --git a/lib/rpmlead.c b/lib/rpmlead.c index be0b249..65fa3af 100644 --- a/lib/rpmlead.c +++ b/lib/rpmlead.c @@ -15,6 +15,7 @@ #include "rpmlead.h" #include "debug.h" +/*@unchecked@*/ /*@observer@*/ static unsigned char lead_magic[] = { RPMLEAD_MAGIC0, RPMLEAD_MAGIC1, RPMLEAD_MAGIC2, RPMLEAD_MAGIC3 }; @@ -26,10 +27,10 @@ int writeLead(FD_t fd, const struct rpmlead *lead) struct rpmlead l; /*@-boundswrite@*/ - memcpy(&l, lead, sizeof(*lead)); -/*@=boundswrite@*/ + memcpy(&l, lead, sizeof(l)); - memcpy(&l.magic, lead_magic, sizeof(lead_magic)); + memcpy(&l.magic, lead_magic, sizeof(l.magic)); +/*@=boundswrite@*/ l.type = htons(l.type); l.archnum = htons(l.archnum); l.osnum = htons(l.osnum); diff --git a/lib/rpmts.h b/lib/rpmts.h index 511eecb..81ec9f4 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -302,8 +302,8 @@ int rpmtsOpenDB(rpmts ts, int dbmode) * @return 0 on success */ int rpmtsInitDB(rpmts ts, int dbmode) - /*@globals fileSystem, internalState @*/ - /*@modifies ts, fileSystem, internalState @*/; + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; /** \ingroup rpmts * Rebuild the database used by the transaction. @@ -320,8 +320,8 @@ int rpmtsRebuildDB(rpmts ts) * @return 0 on success */ int rpmtsVerifyDB(rpmts ts) - /*@globals fileSystem, internalState @*/ - /*@modifies ts, fileSystem, internalState @*/; + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; /** \ingroup rpmts * Return transaction database iterator. diff --git a/rpmdb/fprint.h b/rpmdb/fprint.h index 5a780e2..2b6bb9f 100644 --- a/rpmdb/fprint.h +++ b/rpmdb/fprint.h @@ -75,8 +75,8 @@ extern "C" { */ int rpmdbFindFpList(/*@null@*/ rpmdb db, fingerPrint * fpList, /*@out@*/ dbiIndexSet * matchList, int numItems) - /*@globals fileSystem@*/ - /*@modifies db, *matchList, fileSystem @*/; + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies db, *matchList, rpmGlobalMacroContext, fileSystem @*/; /* Be carefull with the memory... assert(*fullName == '/' || !scareMemory) */ diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 33d8f4e..09bd1b4 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -170,7 +170,6 @@ static int dbiTagToDbix(int rpmtag) /** * Initialize database (index, tag) tuple from configuration. */ -/*@-bounds@*/ /* LCL: segfault */ static void dbiTagsInit(void) /*@globals rpmGlobalMacroContext, dbiTags, dbiTagsMax @*/ /*@modifies rpmGlobalMacroContext, dbiTags, dbiTagsMax @*/ @@ -210,10 +209,8 @@ static void dbiTagsInit(void) *oe++ = '\0'; rpmtag = tagValue(o); if (rpmtag < 0) { - -/*@-modfilesys@*/ - fprintf(stderr, _("dbiTagsInit: unrecognized tag name: \"%s\" ignored\n"), o); -/*@=modfilesys@*/ + rpmMessage(RPMMESS_WARNING, + _("dbiTagsInit: unrecognized tag name: \"%s\" ignored\n"), o); continue; } if (dbiTagToDbix(rpmtag) >= 0) @@ -225,7 +222,6 @@ static void dbiTagsInit(void) dbiTagStr = _free(dbiTagStr); } -/*@=bounds@*/ /*@-redecl@*/ #define DB1vec NULL @@ -265,9 +261,7 @@ dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, /*@unused@*/ unsigned int flags) return dbi; /*@=compdef@*/ -/*@-globs -mods @*/ /* FIX: rpmGlobalMacroContext not in */ _dbapi_rebuild = rpmExpandNumeric("%{_dbapi_rebuild}"); -/*@=globs =mods @*/ if (_dbapi_rebuild < 1 || _dbapi_rebuild > 3) _dbapi_rebuild = 3; _dbapi_wanted = (_rebuildinprogress ? -1 : db->db_api); @@ -278,9 +272,7 @@ dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, /*@unused@*/ unsigned int flags) if (_dbapi < 0 || _dbapi >= 4 || mydbvecs[_dbapi] == NULL) { return NULL; } - /*@-mods@*/ errno = 0; - /*@=mods@*/ dbi = NULL; rc = (*mydbvecs[_dbapi]->open) (db, rpmtag, &dbi); if (rc) { @@ -298,9 +290,7 @@ dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, /*@unused@*/ unsigned int flags) while (_dbapi-- > 1) { if (mydbvecs[_dbapi] == NULL) continue; - /*@-mods@*/ errno = 0; - /*@=mods@*/ dbi = NULL; rc = (*mydbvecs[_dbapi]->open) (db, rpmtag, &dbi); if (rc == 0 && dbi) @@ -921,7 +911,7 @@ int rpmdbSync(rpmdb db) return rc; } -/*@-mods@*/ +/*@-mods@*/ /* FIX: dbTemplate structure assignment */ static /*@only@*/ /*@null@*/ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root, /*@kept@*/ /*@null@*/ const char * home, @@ -981,22 +971,18 @@ static int openDatabase(/*@null@*/ const char * prefix, int mode, int perms, int flags) /*@globals dbrock, rpmGlobalMacroContext, fileSystem, internalState @*/ - /*@modifies dbrock, *dbp, fileSystem, internalState @*/ + /*@modifies dbrock, *dbp, rpmGlobalMacroContext, + fileSystem, internalState @*/ /*@requires maxSet(dbp) >= 0 @*/ { rpmdb db; int rc, xx; static int _tags_initialized = 0; -#ifdef DYING - static int _dbenv_removed = 0; -#endif int justCheck = flags & RPMDB_FLAG_JUSTCHECK; int minimal = flags & RPMDB_FLAG_MINIMAL; if (!_tags_initialized || dbiTagsMax == 0) { - /*@-mods@*/ dbiTagsInit(); - /*@=mods@*/ _tags_initialized++; } @@ -1011,43 +997,11 @@ static int openDatabase(/*@null@*/ const char * prefix, if (mode & O_WRONLY) return 1; - /*@-mods@*/ db = newRpmdb(prefix, dbpath, mode, perms, flags); - /*@=mods@*/ if (db == NULL) return 1; -#ifdef DYING - if (!_dbenv_removed) { - static int _enable_cdb = -1; - - /* XXX hack in suoport for CDB, otherwise nuke the state. */ - /*@-mods@*/ - if (_enable_cdb < 0) - _enable_cdb = rpmExpandNumeric("%{?__dbi_cdb:1}"); - /*@=mods@*/ - - if (!_enable_cdb) { - char * fn; - int i; - - i = sizeof("//__db.000"); - if (db->db_root) i += strlen(db->db_root); - if (db->db_home) i += strlen(db->db_home); - fn = alloca(i); - for (i = 0; i < 16; i++) { - sprintf(fn, "%s/%s/__db.%03d", - (db->db_root ? db->db_root : ""), - (db->db_home ? db->db_home : ""), i); - (void) rpmCleanPath(fn); - (void) unlink(fn); - } - } - _dbenv_removed++; - } -#else (void) enableSignals(); -#endif db->db_api = _dbapi; @@ -1080,8 +1034,8 @@ static int openDatabase(/*@null@*/ const char * prefix, switch (rpmtag) { case RPMDBI_PACKAGES: if (dbi == NULL) rc |= 1; - /* XXX open only Packages, indices created on the fly. */ #if 0 + /* XXX open only Packages, indices created on the fly. */ if (db->db_api == 3) #endif goto exit; @@ -1132,12 +1086,9 @@ fprintf(stderr, "--> db %p ++ %d %s at %s:%u\n", db, db->nrefs, msg, fn, ln); } /* XXX python/rpmmodule.c */ -/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in */ int rpmdbOpen (const char * prefix, rpmdb *dbp, int mode, int perms) { - /*@-mods@*/ int _dbapi = rpmExpandNumeric("%{_dbapi}"); - /*@=mods@*/ /*@-boundswrite@*/ return openDatabase(prefix, NULL, _dbapi, dbp, mode, perms, 0); /*@=boundswrite@*/ @@ -1146,9 +1097,7 @@ int rpmdbOpen (const char * prefix, rpmdb *dbp, int mode, int perms) int rpmdbInit (const char * prefix, int perms) { rpmdb db = NULL; - /*@-mods@*/ int _dbapi = rpmExpandNumeric("%{_dbapi}"); - /*@=mods@*/ int rc; /*@-boundswrite@*/ @@ -1169,9 +1118,7 @@ int rpmdbInit (const char * prefix, int perms) int rpmdbVerify(const char * prefix) { rpmdb db = NULL; - /*@-mods@*/ int _dbapi = rpmExpandNumeric("%{_dbapi}"); - /*@=mods@*/ int rc = 0; /*@-boundswrite@*/ @@ -1201,12 +1148,22 @@ int rpmdbVerify(const char * prefix) } return rc; } -/*@=globs@*/ +/** + * Find file matches in database. + * @param db rpm database + * @param filespec + * @param key + * @param data + * @param matches + * @return 0 on success, 1 on not found, -2 on error + */ static int rpmdbFindByFile(rpmdb db, /*@null@*/ const char * filespec, DBT * key, DBT * data, /*@out@*/ dbiIndexSet * matches) - /*@globals fileSystem @*/ - /*@modifies db, *key, *data, *matches, fileSystem @*/ + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies db, *key, *data, *matches, rpmGlobalMacroContext, + fileSystem @*/ + /*@requires maxSet(matches) >= 0 @*/ { HGE_t hge = (HGE_t)headerGetEntryMinMemory; HFD_t hfd = headerFreeData; @@ -1223,9 +1180,7 @@ static int rpmdbFindByFile(rpmdb db, /*@null@*/ const char * filespec, int rc; int xx; -/*@-boundswrite@*/ *matches = NULL; -/*@=boundswrite@*/ if (filespec == NULL) return -2; /*@-branchstate@*/ @@ -1285,9 +1240,7 @@ if (rc == 0) return rc; } -/*@-boundswrite@*/ *matches = xcalloc(1, sizeof(**matches)); -/*@=boundswrite@*/ rec = dbiIndexNewItem(0, 0); i = 0; if (allMatches != NULL) @@ -1345,9 +1298,7 @@ if (rc == 0) fpc = fpCacheFree(fpc); if ((*matches)->count == 0) { -/*@-boundswrite@*/ *matches = dbiFreeIndexSet(*matches); -/*@=boundswrite@*/ return 1; } @@ -1425,9 +1376,10 @@ static rpmRC dbiFindMatches(dbiIndex dbi, DBC * dbcursor, /*@null@*/ const char * version, /*@null@*/ const char * release, /*@out@*/ dbiIndexSet * matches) - /*@globals fileSystem @*/ - /*@modifies dbi, *dbcursor, *key, *data, *matches, fileSystem @*/ - /*@requires maxSet(*matches) >= 0 @*/ + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies dbi, *dbcursor, *key, *data, *matches, + rpmGlobalMacroContext, fileSystem @*/ + /*@requires maxSet(matches) >= 0 @*/ { int gotMatches = 0; int rc; @@ -1493,20 +1445,16 @@ key->size = strlen(name); /*@=branchstate@*/ if (gotMatches) { -/*@-boundswrite@*/ (*matches)->count = gotMatches; -/*@=boundswrite@*/ rc = RPMRC_OK; } else rc = RPMRC_NOTFOUND; exit: -/*@-boundswrite@*/ /*@-unqualifiedtrans@*/ /* FIX: double indirection */ if (rc && matches && *matches) *matches = dbiFreeIndexSet(*matches); /*@=unqualifiedtrans@*/ -/*@=boundswrite@*/ return rc; } @@ -1524,9 +1472,10 @@ exit: */ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, /*@null@*/ const char * arg, /*@out@*/ dbiIndexSet * matches) - /*@globals fileSystem @*/ - /*@modifies dbi, *dbcursor, *key, *data, *matches, fileSystem @*/ - /*@requires maxSet(*matches) >= 0 @*/ + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies dbi, *dbcursor, *key, *data, *matches, + rpmGlobalMacroContext, fileSystem @*/ + /*@requires maxSet(matches) >= 0 @*/ { const char * release; char * localarg; @@ -1541,11 +1490,9 @@ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, rc = dbiFindMatches(dbi, dbcursor, key, data, arg, NULL, NULL, matches); if (rc != RPMRC_NOTFOUND) return rc; -/*@-boundswrite@*/ /*@-unqualifiedtrans@*/ /* FIX: double indirection */ *matches = dbiFreeIndexSet(*matches); /*@=unqualifiedtrans@*/ -/*@=boundswrite@*/ /* maybe a name and a release */ localarg = alloca(strlen(arg) + 1); @@ -1572,16 +1519,14 @@ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, /*@-boundswrite@*/ *s = '\0'; +/*@=boundswrite@*/ rc = dbiFindMatches(dbi, dbcursor, key, data, localarg, s + 1, NULL, matches); /*@=nullstate@*/ -/*@=boundswrite@*/ if (rc != RPMRC_NOTFOUND) return rc; -/*@-boundswrite@*/ /*@-unqualifiedtrans@*/ /* FIX: double indirection */ *matches = dbiFreeIndexSet(*matches); /*@=unqualifiedtrans@*/ -/*@=boundswrite@*/ /* how about name-version-release? */ @@ -1607,10 +1552,10 @@ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data, /*@-boundswrite@*/ *s = '\0'; +/*@=boundswrite@*/ /*@-nullstate@*/ /* FIX: *matches may be NULL. */ return dbiFindMatches(dbi, dbcursor, key, data, localarg, s + 1, release, matches); /*@=nullstate@*/ -/*@=boundswrite@*/ } typedef struct miRE_s { @@ -1941,9 +1886,8 @@ int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag, /*@-boundsread@*/ if (defmode == (rpmMireMode)-1) { - /*@-globs -mods @*/ const char *t = rpmExpand("%{?_query_selector_match}", NULL); - /*@=globs =mods @*/ + if (*t == '\0' || !strcmp(t, "default")) defmode = RPMMIRE_DEFAULT; else if (!strcmp(t, "strcmp")) @@ -2389,8 +2333,8 @@ static void rpmdbSortIterator(/*@null@*/ rpmdbMatchIterator mi) /*@-bounds@*/ /* LCL: segfault */ static int rpmdbGrowIterator(/*@null@*/ rpmdbMatchIterator mi, int fpNum) - /*@globals fileSystem @*/ - /*@modifies mi, fileSystem @*/ + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies mi, rpmGlobalMacroContext, fileSystem @*/ { DBC * dbcursor; DBT * key; diff --git a/rpmdb/rpmdb.h b/rpmdb/rpmdb.h index ea2a85c..e868469 100644 --- a/rpmdb/rpmdb.h +++ b/rpmdb/rpmdb.h @@ -491,7 +491,8 @@ extern const char *const prDbiOpenFlags(int dbflags, int print_dbenv_flags) */ /*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, rpmTag rpmtag, unsigned int flags) - /*@modifies db @*/; + /*@globals rpmGlobalMacroContext, errno @*/ + /*@modifies db, rpmGlobalMacroContext, errno @*/; /*@-globuse -mustmod @*/ /* FIX: vector annotations */ /** \ingroup dbi @@ -839,8 +840,8 @@ rpmdb XrpmdbLink (rpmdb db, const char * msg, */ int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp, int mode, int perms) - /*@globals fileSystem, internalState @*/ - /*@modifies *dbp, fileSystem, internalState @*/; + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies *dbp, rpmGlobalMacroContext, fileSystem, internalState @*/; /** \ingroup rpmdb * Initialize database. @@ -849,8 +850,8 @@ int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp, * @return 0 on success */ int rpmdbInit(/*@null@*/ const char * prefix, int perms) - /*@globals fileSystem, internalState @*/ - /*@modifies fileSystem, internalState @*/; + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/; /** \ingroup rpmdb * Verify database components. @@ -858,8 +859,8 @@ int rpmdbInit(/*@null@*/ const char * prefix, int perms) * @return 0 on success */ int rpmdbVerify(/*@null@*/ const char * prefix) - /*@globals fileSystem, internalState @*/ - /*@modifies fileSystem, internalState @*/; + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/; /** * Close a single database index. @@ -896,7 +897,8 @@ int rpmdbSync (/*@null@*/ rpmdb db) */ /*@-exportlocal@*/ int rpmdbOpenAll (/*@null@*/ rpmdb db) - /*@modifies db @*/; + /*@globals rpmGlobalMacroContext @*/ + /*@modifies db, rpmGlobalMacroContext @*/; /*@=exportlocal@*/ /** \ingroup rpmdb @@ -906,8 +908,8 @@ int rpmdbOpenAll (/*@null@*/ rpmdb db) * @return number of instances */ int rpmdbCountPackages(/*@null@*/ rpmdb db, const char * name) - /*@globals fileSystem @*/ - /*@modifies db, fileSystem @*/; + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies db, rpmGlobalMacroContext, fileSystem @*/; /** \ingroup rpmdb * Return header join key for current position of rpm database iterator. @@ -959,7 +961,8 @@ int rpmdbPruneIterator(/*@null@*/ rpmdbMatchIterator mi, */ int rpmdbSetIteratorRE(/*@null@*/ rpmdbMatchIterator mi, rpmTag tag, rpmMireMode mode, /*@null@*/ const char * pattern) - /*@modifies mi, mode @*/; + /*@globals rpmGlobalMacroContext @*/ + /*@modifies mi, mode, rpmGlobalMacroContext @*/; /** \ingroup rpmdb * Prepare iterator for lazy writes. @@ -1002,8 +1005,8 @@ int rpmdbSetHdrChk(/*@null@*/ rpmdbMatchIterator mi, /*@null@*/ rpmts ts, /*@only@*/ /*@null@*/ rpmdbMatchIterator rpmdbInitIterator(/*@null@*/ rpmdb db, rpmTag rpmtag, /*@null@*/ const void * keyp, size_t keylen) - /*@globals fileSystem @*/ - /*@modifies db, fileSystem @*/; + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies db, rpmGlobalMacroContext, fileSystem @*/; /** \ingroup rpmdb * Return next package header from iteration. @@ -1012,8 +1015,8 @@ rpmdbMatchIterator rpmdbInitIterator(/*@null@*/ rpmdb db, rpmTag rpmtag, */ /*@null@*/ Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi) - /*@globals fileSystem @*/ - /*@modifies mi, fileSystem @*/; + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies mi, rpmGlobalMacroContext, fileSystem @*/; /** \ingroup rpmdb * Destroy rpm database iterator. @@ -1022,8 +1025,8 @@ Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi) */ /*@null@*/ rpmdbMatchIterator rpmdbFreeIterator(/*@only@*/ /*@null@*/rpmdbMatchIterator mi) - /*@globals fileSystem @*/ - /*@modifies mi, fileSystem @*/; + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies mi, rpmGlobalMacroContext, fileSystem @*/; /** \ingroup rpmdb * Add package header to rpm database and indices. @@ -1036,8 +1039,8 @@ rpmdbMatchIterator rpmdbFreeIterator(/*@only@*/ /*@null@*/rpmdbMatchIterator mi) */ int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts, /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg)) - /*@globals fileSystem @*/ - /*@modifies db, h, fileSystem @*/; + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies db, h, rpmGlobalMacroContext, fileSystem @*/; /** \ingroup rpmdb * Remove package header from rpm database and indices. @@ -1051,8 +1054,8 @@ int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts, int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum, /*@null@*/ rpmts ts, /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg)) - /*@globals fileSystem @*/ - /*@modifies db, fileSystem @*/; + /*@globals rpmGlobalMacroContext, fileSystem @*/ + /*@modifies db, rpmGlobalMacroContext, fileSystem @*/; /** \ingroup rpmdb * Rebuild database indices from package headers.