summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/depends.c2
-rw-r--r--lib/query.c10
-rw-r--r--lib/rpmcli.h4
-rw-r--r--lib/rpmgi.c26
-rw-r--r--lib/rpmgi.h9
5 files changed, 35 insertions, 16 deletions
diff --git a/lib/depends.c b/lib/depends.c
index 0d4c0a4e4..14df1d478 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -177,8 +177,10 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
continue;
/* XXX Never check source headers. */
+/*@-type @*/
if (p->isSource)
continue;
+/*@=type @*/
if (tscolor) {
if (arch == NULL || (parch = rpmteA(p)) == NULL)
diff --git a/lib/query.c b/lib/query.c
index b45bdbb33..8f48ef2b4 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -25,6 +25,8 @@
#include "debug.h"
+/*@access rpmgi @*/
+
/**
*/
static void printFileInfo(char * te, const char * name,
@@ -361,6 +363,8 @@ void rpmDisplayQueryTags(FILE * fp)
}
static int rpmgiShowMatches(QVA_t qva, rpmts ts)
+ /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
+ /*@modifies qva, rpmGlobalMacroContext, h_errno, internalState @*/
{
rpmgi gi = qva->qva_gi;
int ec = 0;
@@ -370,7 +374,7 @@ static int rpmgiShowMatches(QVA_t qva, rpmts ts)
int rc;
/* XXX delayed spewage. */
- if (gi->flags & RPMGI_TSADD)
+ if (gi != NULL && gi->flags & RPMGI_TSADD)
continue;
h = rpmgiHeader(gi);
@@ -718,9 +722,9 @@ int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_t argv)
rpmtsEmpty(ts);
break;
default:
- giFlags |= (RPMGI_NOGLOB|RPMGI_NOHEADER);
qva->qva_gi = rpmgiNew(ts, RPMDBI_ARGLIST, NULL, 0);
- qva->qva_rc = rpmgiSetArgs(qva->qva_gi, argv, 0, giFlags);
+ qva->qva_rc = rpmgiSetArgs(qva->qva_gi, argv, ftsOpts,
+ (giFlags | (RPMGI_NOGLOB|RPMGI_NOHEADER)));
while (rpmgiNext(qva->qva_gi) == RPMRC_OK) {
ec += rpmQueryVerify(qva, ts, rpmgiHdrPath(qva->qva_gi));
rpmtsEmpty(ts);
diff --git a/lib/rpmcli.h b/lib/rpmcli.h
index 79b420b74..f1647d6fc 100644
--- a/lib/rpmcli.h
+++ b/lib/rpmcli.h
@@ -383,9 +383,9 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
* @return 0 on success, else no. of failures
*/
int rpmcliArgIter(rpmts ts, QVA_t qva, /*@null@*/ ARGV_t argv)
- /*@globals rpmGlobalMacroContext, h_errno,
+ /*@globals ftsOpts, rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/
- /*@modifies ts, qva, rpmGlobalMacroContext,
+ /*@modifies ts, qva, ftsOpts, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
diff --git a/lib/rpmgi.c b/lib/rpmgi.c
index a3098fdae..0d9f50ca7 100644
--- a/lib/rpmgi.c
+++ b/lib/rpmgi.c
@@ -17,7 +17,10 @@
#include "debug.h"
+/*@access fnpyKey @*/
/*@access rpmdbMatchIterator @*/
+/*@access rpmts @*/
+/*@access rpmps @*/
/*@unchecked@*/
int _rpmgi_debug = 0;
@@ -196,8 +199,7 @@ static rpmRC rpmgiLoadReadHeader(rpmgi gi)
*/
/*@null@*/
static rpmRC rpmgiWalkPathFilter(rpmgi gi)
- /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
- /*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/
+ /*@*/
{
FTSENT * fts = gi->fts;
rpmRC rpmrc = RPMRC_NOTFOUND;
@@ -260,8 +262,10 @@ static rpmRC rpmgiWalkReadHeader(rpmgi gi)
if (rpmrc == RPMRC_OK) {
Header h = NULL;
- if (!(gi->flags & RPMGI_NOHEADER))
- h = rpmgiReadHeader(gi, gi->fts->fts_path);
+ if (!(gi->flags & RPMGI_NOHEADER)) {
+ if (gi->fts != NULL) /* XXX can't happen */
+ h = rpmgiReadHeader(gi, gi->fts->fts_path);
+ }
if (h != NULL)
gi->h = headerLink(h);
h = headerFree(h);
@@ -292,7 +296,9 @@ static rpmRC rpmgiGlobArgv(rpmgi gi, /*@null@*/ ARGV_t argv)
if (argv != NULL) {
while (argv[ac] != NULL)
ac++;
+/*@-nullstate@*/ /* XXX argv is not NULL */
xx = argvAppend(&gi->argv, argv);
+/*@=nullstate@*/
}
gi->argc = ac;
return rpmrc;
@@ -317,7 +323,8 @@ static rpmRC rpmgiGlobArgv(rpmgi gi, /*@null@*/ ARGV_t argv)
* @returns RPMRC_OK on success
*/
static rpmRC rpmgiInitFilter(rpmgi gi)
- /*@modifies gi @*/
+ /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
+ /*@modifies gi, rpmGlobalMacroContext, h_errno, internalState @*/
{
rpmRC rpmrc = RPMRC_OK;
ARGV_t av;
@@ -338,6 +345,7 @@ fprintf(stderr, "*** gi %p\tmi %p\n", gi, gi->mi);
tag = RPMTAG_NAME;
/* Parse for "tag=pattern" args. */
+/*@-branchstate@*/
if ((ae = strchr(a, '=')) != NULL) {
*ae++ = '\0';
tag = tagValue(a);
@@ -347,6 +355,7 @@ fprintf(stderr, "*** gi %p\tmi %p\n", gi, gi->mi);
}
pat = ae;
}
+/*@=branchstate@*/
if (!res) {
if (_rpmgi_debug < 0)
@@ -435,7 +444,9 @@ rpmgi rpmgiNew(rpmts ts, int tag, const void * keyp, size_t keylen)
gi->ts = rpmtsLink(ts, __FUNCTION__);
gi->tag = tag;
+/*@-assignexpose@*/
gi->keyp = keyp;
+/*@=assignexpose@*/
gi->keylen = keylen;
gi->flags = 0;
@@ -607,9 +618,8 @@ enditer:
/*@=branchstate@*/
}
- rpmpsFree(ps);
- rpmpsFree(ts->probs); /* XXX hackery */
- ts->probs = NULL;
+ ps = rpmpsFree(ps);
+ ts->probs = rpmpsFree(ts->probs); /* XXX hackery */
xx = rpmtsOrder(ts);
diff --git a/lib/rpmgi.h b/lib/rpmgi.h
index 038fcb350..674133182 100644
--- a/lib/rpmgi.h
+++ b/lib/rpmgi.h
@@ -38,6 +38,7 @@ struct rpmgi_s {
/*@refcounted@*/
rpmts ts; /*!< Iterator transaction set. */
int tag; /*!< Iterator type. */
+/*@kept@*/ /*@relnull@*/
const void * keyp; /*!< Iterator key. */
size_t keylen; /*!< Iterator key length. */
@@ -61,7 +62,7 @@ struct rpmgi_s {
int ftsOpts;
/*@null@*/
FTS * ftsp;
-/*@null@*/
+/*@relnull@*/
FTSENT * fts;
/*@refs@*/
@@ -128,7 +129,8 @@ rpmgi rpmgiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmgi gi)
* @return new iterator
*/
/*@null@*/
-rpmgi rpmgiNew(rpmts ts, int tag, /*@null@*/ const void * keyp, size_t keylen)
+rpmgi rpmgiNew(rpmts ts, int tag, /*@kept@*/ /*@null@*/ const void * keyp,
+ size_t keylen)
/*@globals internalState @*/
/*@modifies ts, internalState @*/;
@@ -178,7 +180,8 @@ rpmts rpmgiTs(/*@null@*/ rpmgi gi)
*/
rpmRC rpmgiSetArgs(rpmgi gi, /*@null@*/ ARGV_t argv,
int ftsOpts, rpmgiFlags flags)
- /*@modifies gi @*/;
+ /*@globals internalState @*/
+ /*@modifies gi, internalState @*/;
#ifdef __cplusplus
}