summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rpmdb/db3.c179
-rw-r--r--rpmdb/dbconfig.c57
-rw-r--r--rpmdb/fprint.c41
-rw-r--r--rpmdb/fprint.h32
-rw-r--r--rpmdb/hdrNVR.c6
-rw-r--r--rpmdb/hdrinline.h174
-rw-r--r--rpmdb/header.c641
-rw-r--r--rpmdb/header.h180
-rw-r--r--rpmdb/header_internal.c47
-rw-r--r--rpmdb/header_internal.h52
-rw-r--r--rpmdb/legacy.c51
-rw-r--r--rpmdb/legacy.h24
-rw-r--r--rpmdb/merge.c25
-rw-r--r--rpmdb/rpmdb.c640
-rw-r--r--rpmdb/rpmdb.h427
-rw-r--r--rpmdb/rpmhash.c35
-rw-r--r--rpmdb/rpmhash.h37
-rw-r--r--rpmdb/sqlite.c191
-rw-r--r--rpmdb/tagname.c26
19 files changed, 668 insertions, 2197 deletions
diff --git a/rpmdb/db3.c b/rpmdb/db3.c
index 4ca257a69..01b211c83 100644
--- a/rpmdb/db3.c
+++ b/rpmdb/db3.c
@@ -1,9 +1,8 @@
-/*@-type@*/ /* FIX: annotate db3 methods */
+/* FIX: annotate db3 methods */
/** \ingroup db3
* \file rpmdb/db3.c
*/
-/*@unchecked@*/
static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
#include "system.h"
@@ -24,14 +23,10 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
#define DB_CLIENT DB_RPCCLIENT
#endif
-/*@access rpmdb @*/
-/*@access dbiIndex @*/
-/*@access dbiIndexSet @*/
/** \ingroup dbi
* Hash database statistics.
*/
-/*@-fielduse@*/
struct dbiHStats_s {
unsigned int hash_magic; /*!< hash database magic number. */
unsigned int hash_version; /*!< version of the hash database. */
@@ -74,7 +69,6 @@ struct dbiBStats_s {
unsigned int bt_dup_pgfree; /*!< no. of bytes free in duplicate pages. */
unsigned int bt_over_pgfree;/*!< no. of bytes free in overflow pages. */
};
-/*@=fielduse@*/
#ifdef NOTNOW
static const char * bfstring(unsigned int x, const char * xbf)
@@ -147,33 +141,26 @@ static const char * dbiModeFlags =
#endif /* NOTNOW */
-/*@-globuse -mustmod @*/ /* FIX: rpmError not annotated yet. */
static int cvtdberr(dbiIndex dbi, const char * msg, int error, int printit)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
int rc = error;
if (printit && rc) {
- /*@-moduncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
if (msg)
rpmError(RPMERR_DBERR, _("db%d error(%d) from %s: %s\n"),
dbi->dbi_api, rc, msg, db_strerror(error));
else
rpmError(RPMERR_DBERR, _("db%d error(%d): %s\n"),
dbi->dbi_api, rc, db_strerror(error));
- /*@=moduncon@*/
}
return rc;
}
-/*@=globuse =mustmod @*/
static int db_fini(dbiIndex dbi, const char * dbhome,
- /*@null@*/ const char * dbfile,
- /*@unused@*/ /*@null@*/ const char * dbsubfile)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ const char * dbfile,
+ const char * dbsubfile)
{
rpmdb rpmdb = dbi->dbi_rpmdb;
DB_ENV * dbenv = rpmdb->db_dbenv;
@@ -192,9 +179,8 @@ static int db_fini(dbiIndex dbi, const char * dbhome,
if (rpmdb->db_remove_env) {
int xx;
- /*@-moduncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
xx = db_env_create(&dbenv, 0);
- /*@=moduncon@*/
xx = cvtdberr(dbi, "db_env_create", xx, _debug);
#if (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR != 0) || (DB_VERSION_MAJOR == 4)
xx = dbenv->remove(dbenv, dbhome, 0);
@@ -211,8 +197,7 @@ static int db_fini(dbiIndex dbi, const char * dbhome,
return rc;
}
-static int db3_fsync_disable(/*@unused@*/ int fd)
- /*@*/
+static int db3_fsync_disable(int fd)
{
return 0;
}
@@ -228,7 +213,6 @@ static int db3_fsync_disable(/*@unused@*/ int fd)
* @return 0 == shared.
*/
static int db3_pthread_nptl(void)
- /*@*/
{
pthread_mutex_t mutex;
pthread_mutexattr_t mutexattr, *mutexattrp = NULL;
@@ -268,14 +252,11 @@ static int db3_pthread_nptl(void)
#endif
#endif
-/*@-moduncon@*/ /* FIX: annotate db3 methods */
+/* FIX: annotate db3 methods */
static int db_init(dbiIndex dbi, const char * dbhome,
- /*@null@*/ const char * dbfile,
- /*@unused@*/ /*@null@*/ const char * dbsubfile,
- /*@out@*/ DB_ENV ** dbenvp)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem @*/
- /*@modifies dbi, *dbenvp, fileSystem @*/
+ const char * dbfile,
+ const char * dbsubfile,
+ DB_ENV ** dbenvp)
{
rpmdb rpmdb = dbi->dbi_rpmdb;
DB_ENV *dbenv = NULL;
@@ -286,10 +267,8 @@ static int db_init(dbiIndex dbi, const char * dbhome,
return 1;
/* XXX HACK */
- /*@-assignexpose@*/
if (rpmdb->db_errfile == NULL)
rpmdb->db_errfile = stderr;
- /*@=assignexpose@*/
eflags = (dbi->dbi_oeflags | dbi->dbi_eflags);
if (eflags & DB_JOINENV) eflags &= DB_JOINENV;
@@ -317,7 +296,7 @@ static int db_init(dbiIndex dbi, const char * dbhome,
goto errxit;
{ int xx;
- /*@-noeffectuncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
/* 4.1: dbenv->set_app_dispatch(???) */
/* 4.1: dbenv->set_alloc(???) */
@@ -327,7 +306,6 @@ static int db_init(dbiIndex dbi, const char * dbhome,
dbenv->set_errcall(dbenv, (void *) rpmdb->db_errcall);
dbenv->set_errfile(dbenv, rpmdb->db_errfile);
dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
- /*@=noeffectuncon@*/
/* 4.1: dbenv->set_feedback(???) */
/* 4.1: dbenv->set_flags(???) */
@@ -377,13 +355,9 @@ static int db_init(dbiIndex dbi, const char * dbhome,
const char * tmpdir;
root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
-/*@-boundsread@*/
if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
root = NULL;
-/*@=boundsread@*/
-/*@-mods@*/
tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
-/*@=mods@*/
xx = dbenv->set_tmp_dir(dbenv, tmpdir);
xx = cvtdberr(dbi, "dbenv->set_tmp_dir", xx, _debug);
tmpdir = _free(tmpdir);
@@ -438,9 +412,7 @@ static int db_init(dbiIndex dbi, const char * dbhome,
if (rc)
goto errxit;
-/*@-boundswrite@*/
*dbenvp = dbenv;
-/*@=boundswrite@*/
return 0;
@@ -452,11 +424,8 @@ errxit:
}
return rc;
}
-/*@=moduncon@*/
static int db3sync(dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
DB * db = dbi->dbi_db;
int rc = 0;
@@ -476,26 +445,18 @@ static int db3sync(dbiIndex dbi, unsigned int flags)
static int db3cdup(dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcp, fileSystem @*/
{
int rc;
-/*@-boundswrite@*/
if (dbcp) *dbcp = NULL;
-/*@=boundswrite@*/
rc = dbcursor->c_dup(dbcursor, dbcp, flags);
rc = cvtdberr(dbi, "dbcursor->c_dup", rc, _debug);
- /*@-nullstate @*/ /* FIX: *dbcp can be NULL */
+ /* FIX: *dbcp can be NULL */
return rc;
- /*@=nullstate @*/
}
-/*@-mustmod@*/
-static int db3cclose(dbiIndex dbi, /*@only@*/ /*@null@*/ DBC * dbcursor,
- /*@unused@*/ unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
+static int db3cclose(dbiIndex dbi, DBC * dbcursor,
+ unsigned int flags)
{
int rc = -2;
@@ -506,12 +467,9 @@ static int db3cclose(dbiIndex dbi, /*@only@*/ /*@null@*/ DBC * dbcursor,
}
return rc;
}
-/*@=mustmod@*/
static int db3copen(dbiIndex dbi, DB_TXN * txnid,
- /*@null@*/ /*@out@*/ DBC ** dbcp, unsigned int dbiflags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/
+ DBC ** dbcp, unsigned int dbiflags)
{
DB * db = dbi->dbi_db;
DBC * dbcursor = NULL;
@@ -531,7 +489,7 @@ static int db3copen(dbiIndex dbi, DB_TXN * txnid,
rc = cvtdberr(dbi, "db->cursor", rc, _debug);
if (dbcp)
- /*@-boundswrite -onlytrans@*/ *dbcp = dbcursor; /*@=boundswrite =onlytrans@*/
+ *dbcp = dbcursor;
else
(void) db3cclose(dbi, dbcursor, 0);
@@ -539,9 +497,7 @@ static int db3copen(dbiIndex dbi, DB_TXN * txnid,
}
static int db3cput(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
- /*@unused@*/ unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ unsigned int flags)
{
DB * db = dbi->dbi_db;
int rc;
@@ -558,11 +514,8 @@ static int db3cput(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
return rc;
}
-/*@-mustmod@*/
static int db3cdel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/
{
DB * db = dbi->dbi_db;
int rc;
@@ -588,13 +541,9 @@ static int db3cdel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
return rc;
}
-/*@=mustmod@*/
-/*@-mustmod@*/
static int db3cget(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, *key, *data, fileSystem @*/
{
DB * db = dbi->dbi_db;
int _printit;
@@ -617,13 +566,9 @@ static int db3cget(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
return rc;
}
-/*@=mustmod@*/
-/*@-mustmod@*/
static int db3cpget(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * pkey,
DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, *key, *data, fileSystem @*/
{
DB * db = dbi->dbi_db;
int _printit;
@@ -640,13 +585,10 @@ static int db3cpget(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * pkey,
return rc;
}
-/*@=mustmod@*/
static int db3ccount(dbiIndex dbi, DBC * dbcursor,
- /*@null@*/ /*@out@*/ unsigned int * countp,
- /*@unused@*/ unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *countp, fileSystem @*/
+ unsigned int * countp,
+ unsigned int flags)
{
db_recno_t count = 0;
int rc = 0;
@@ -655,14 +597,12 @@ static int db3ccount(dbiIndex dbi, DBC * dbcursor,
rc = dbcursor->c_count(dbcursor, &count, flags);
rc = cvtdberr(dbi, "dbcursor->c_count", rc, _debug);
if (rc) return rc;
-/*@-boundswrite@*/
if (countp) *countp = count;
-/*@=boundswrite@*/
return rc;
}
-static int db3byteswapped(dbiIndex dbi) /*@*/
+static int db3byteswapped(dbiIndex dbi)
{
DB * db = dbi->dbi_db;
int rc = 0;
@@ -683,8 +623,6 @@ static int db3byteswapped(dbiIndex dbi) /*@*/
}
static int db3stat(dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
{
DB * db = dbi->dbi_db;
#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
@@ -714,18 +652,15 @@ static int db3stat(dbiIndex dbi, unsigned int flags)
return rc;
}
-/*@-mustmod@*/
static int db3associate(dbiIndex dbi, dbiIndex dbisecondary,
int (*callback)(DB *, const DBT *, const DBT *, DBT *),
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
{
DB * db = dbi->dbi_db;
DB * secondary = dbisecondary->dbi_db;
int rc;
-/*@-moduncon@*/ /* FIX: annotate db3 methods */
+/* FIX: annotate db3 methods */
#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
DB_TXN * txnid = NULL;
@@ -735,35 +670,25 @@ assert(db != NULL);
assert(db != NULL);
rc = db->associate(db, secondary, callback, flags);
#endif
-/*@=moduncon@*/
rc = cvtdberr(dbi, "db->associate", rc, _debug);
return rc;
}
-/*@=mustmod@*/
-/*@-mustmod@*/
static int db3join(dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
{
DB * db = dbi->dbi_db;
int rc;
assert(db != NULL);
-/*@-moduncon@*/ /* FIX: annotate db3 methods */
+/* FIX: annotate db3 methods */
rc = db->join(db, curslist, dbcp, flags);
-/*@=moduncon@*/
rc = cvtdberr(dbi, "db->join", rc, _debug);
return rc;
}
-/*@=mustmod@*/
-/*@-moduncon@*/ /* FIX: annotate db3 methods */
-static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem @*/
- /*@modifies dbi, fileSystem @*/
+/* FIX: annotate db3 methods */
+static int db3close(dbiIndex dbi, unsigned int flags)
{
rpmdb rpmdb = dbi->dbi_rpmdb;
const char * urlfn = NULL;
@@ -782,19 +707,15 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
* Get the prefix/root component and directory path.
*/
root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
-/*@-boundsread@*/
if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
root = NULL;
-/*@=boundsread@*/
home = (dbi->dbi_home ? dbi->dbi_home : rpmdb->db_home);
/*
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
- /*@-mods@*/
urlfn = rpmGenPath(root, home, NULL);
- /*@=mods@*/
(void) urlPath(urlfn, &dbhome);
if (dbi->dbi_temporary) {
dbfile = NULL;
@@ -823,9 +744,7 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
if (rpmdb->db_dbenv != NULL && dbi->dbi_use_dbenv) {
if (rpmdb->db_opens == 1) {
- /*@-nullstate@*/
xx = db_fini(dbi, (dbhome ? dbhome : ""), dbfile, dbsubfile);
- /*@=nullstate@*/
rpmdb->db_dbenv = NULL;
}
rpmdb->db_opens--;
@@ -834,18 +753,16 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
if (dbi->dbi_verify_on_close && !dbi->dbi_temporary) {
DB_ENV * dbenv = NULL;
- /*@-moduncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
rc = db_env_create(&dbenv, 0);
- /*@=moduncon@*/
rc = cvtdberr(dbi, "db_env_create", rc, _debug);
if (rc || dbenv == NULL) goto exit;
- /*@-noeffectuncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
dbenv->set_errcall(dbenv, (void *) rpmdb->db_errcall);
dbenv->set_errfile(dbenv, rpmdb->db_errfile);
dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
/* dbenv->set_paniccall(???) */
- /*@=noeffectuncon@*/
#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
xx = dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
(dbi->dbi_verbose & DB_VERB_CHKPOINT));
@@ -858,9 +775,7 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
(dbi->dbi_verbose & DB_VERB_WAITSFOR));
if (dbi->dbi_tmpdir) {
- /*@-mods@*/
const char * tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
- /*@=mods@*/
rc = dbenv->set_tmp_dir(dbenv, tmpdir);
rc = cvtdberr(dbi, "dbenv->set_tmp_dir", rc, _debug);
tmpdir = _free(tmpdir);
@@ -872,15 +787,12 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
rc = cvtdberr(dbi, "dbenv->open", rc, _debug);
if (rc) goto exit;
- /*@-moduncon -nullstate@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
rc = db_create(&db, dbenv, 0);
- /*@=moduncon =nullstate@*/
rc = cvtdberr(dbi, "db_create", rc, _debug);
if (db != NULL) {
- /*@-mods@*/
const char * dbf = rpmGetPath(dbhome, "/", dbfile, NULL);
- /*@=mods@*/
rc = db->verify(db, dbf, NULL, NULL, flags);
rc = cvtdberr(dbi, "db->verify", rc, _debug);
@@ -910,16 +822,10 @@ exit:
return rc;
}
-/*@=moduncon@*/
static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies *dbip, fileSystem, internalState @*/
{
- /*@-nestedextern -shadow@*/
extern struct _dbiVec db3vec;
- /*@=nestedextern =shadow@*/
const char * urlfn = NULL;
const char * root;
const char * home;
@@ -938,39 +844,29 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
u_int32_t oflags;
int _printit;
-/*@-boundswrite@*/
if (dbip)
*dbip = NULL;
-/*@=boundswrite@*/
/*
* Parse db configuration parameters.
*/
- /*@-mods@*/
if ((dbi = db3New(rpmdb, rpmtag)) == NULL)
- /*@-nullstate@*/
return 1;
- /*@=nullstate@*/
- /*@=mods@*/
dbi->dbi_api = DB_VERSION_MAJOR;
/*
* Get the prefix/root component and directory path.
*/
root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
-/*@-boundsread@*/
if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
root = NULL;
-/*@=boundsread@*/
home = (dbi->dbi_home ? dbi->dbi_home : rpmdb->db_home);
/*
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
- /*@-mods@*/
urlfn = rpmGenPath(root, home, NULL);
- /*@=mods@*/
(void) urlPath(urlfn, &dbhome);
if (dbi->dbi_temporary) {
dbfile = NULL;
@@ -1063,9 +959,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
}
} else { /* dbhome is writable, check for persistent dbenv. */
- /*@-mods@*/
const char * dbf = rpmGetPath(dbhome, "/__db.001", NULL);
- /*@=mods@*/
if (access(dbf, F_OK) == -1) {
/* ... non-existent (or unwritable) DBENV, will create ... */
@@ -1091,9 +985,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
if ((oflags & DB_CREATE) && (oflags & DB_RDONLY)) {
/* dbhome is writable, and DB->open flags may conflict. */
const char * dbfn = (dbfile ? dbfile : tagName(dbi->dbi_rpmtag));
- /*@-mods@*/
const char * dbf = rpmGetPath(dbhome, "/", dbfn, NULL);
- /*@=mods@*/
if (access(dbf, F_OK) == -1) {
/* File does not exist, DB->open might create ... */
@@ -1119,7 +1011,6 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
dbi->dbi_verify_on_close = 0;
if (dbi->dbi_use_dbenv) {
- /*@-mods@*/
if (rpmdb->db_dbenv == NULL) {
rc = db_init(dbi, dbhome, dbfile, dbsubfile, &dbenv);
if (rc == 0) {
@@ -1130,7 +1021,6 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
dbenv = rpmdb->db_dbenv;
rpmdb->db_opens++;
}
- /*@=mods@*/
}
rpmMessage(RPMMESS_DEBUG, _("opening db index %s/%s %s mode=0x%x\n"),
@@ -1140,9 +1030,8 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
if (rc == 0) {
static int _lockdbfd = 0;
- /*@-moduncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
rc = db_create(&db, dbenv, dbi->dbi_cflags);
- /*@=moduncon@*/
rc = cvtdberr(dbi, "db_create", rc, _debug);
if (rc == 0 && db != NULL) {
@@ -1289,11 +1178,9 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
if (dbfile) nb += 1 + strlen(dbfile);
dbfullpath = t = alloca(nb + 1);
-/*@-boundswrite@*/
t = stpcpy(t, dbhome);
if (dbfile)
t = stpcpy( stpcpy( t, "/"), dbfile);
-/*@=boundswrite@*/
#ifdef HACK /* XXX necessary to support dbsubfile */
dbpath = (!dbi->dbi_use_dbenv && !dbi->dbi_temporary)
? dbfullpath : dbfile;
@@ -1357,9 +1244,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
rc = 1;
} else {
struct flock l;
-/*@-boundswrite@*/
memset(&l, 0, sizeof(l));
-/*@=boundswrite@*/
l.l_whence = 0;
l.l_start = 0;
l.l_len = 0;
@@ -1393,9 +1278,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
if (rc == 0 && dbi->dbi_db != NULL && dbip != NULL) {
dbi->dbi_vec = &db3vec;
-/*@-boundswrite@*/
*dbip = dbi;
-/*@=boundswrite@*/
} else {
dbi->dbi_verify_on_close = 0;
(void) db3close(dbi, 0);
@@ -1403,20 +1286,14 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
urlfn = _free(urlfn);
- /*@-nullstate -compmempass@*/
return rc;
- /*@=nullstate =compmempass@*/
}
/** \ingroup db3
*/
-/*@-exportheadervar@*/
-/*@observer@*/ /*@unchecked@*/
struct _dbiVec db3vec = {
DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
db3open, db3close, db3sync, db3associate, db3join,
db3copen, db3cclose, db3cdup, db3cdel, db3cget, db3cpget, db3cput, db3ccount,
db3byteswapped, db3stat
};
-/*@=exportheadervar@*/
-/*@=type@*/
diff --git a/rpmdb/dbconfig.c b/rpmdb/dbconfig.c
index 3d525ffb5..a07d35430 100644
--- a/rpmdb/dbconfig.c
+++ b/rpmdb/dbconfig.c
@@ -10,28 +10,18 @@
#include "rpmdb.h"
#include "debug.h"
-/*@access rpmdb@*/
-/*@access dbiIndex@*/
-/*@access dbiIndexSet@*/
#if (DB_VERSION_MAJOR == 3) || (DB_VERSION_MAJOR == 4)
#define __USE_DB3 1
-/*@-exportlocal -exportheadervar@*/
-/*@unchecked@*/
struct _dbiIndex db3dbi;
-/*@=exportlocal =exportheadervar@*/
-/*@unchecked@*/
static int dbi_use_cursors;
-/*@unchecked@*/
static int dbi_tear_down;
-/*@-compmempass -immediatetrans -exportlocal -exportheadervar@*/
/** \ingroup db3
*/
-/*@unchecked@*/
struct poptOption rdbOptions[] = {
/* XXX DB_CXX_NO_EXCEPTIONS */
#if defined(DB_CLIENT)
@@ -249,7 +239,6 @@ struct poptOption rdbOptions[] = {
POPT_TABLEEND
};
-/*@=compmempass =immediatetrans =exportlocal =exportheadervar@*/
dbiIndex db3Free(dbiIndex dbi)
{
@@ -269,11 +258,9 @@ dbiIndex db3Free(dbiIndex dbi)
}
/** @todo Set a reasonable "last gasp" default db config. */
-/*@observer@*/ /*@unchecked@*/
static const char *db3_config_default =
"db3:hash:mpool:cdb:usecursors:verbose:mp_mmapsize=8Mb:cachesize=512Kb:pagesize=512:perms=0644";
-/*@-bounds@*/
dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
{
dbiIndex dbi = xcalloc(1, sizeof(*dbi));
@@ -291,7 +278,6 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
}
/* Parse the options for the database element(s). */
- /*@-branchstate@*/
if (dbOpts && *dbOpts && *dbOpts != '%') {
char *o, *oe;
char *p, *pe;
@@ -310,9 +296,9 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
/* Find and terminate next key=value pair. Save next start point. */
for (oe = o; oe && *oe; oe++) {
if (xisspace(*oe))
- /*@innerbreak@*/ break;
+ break;
if (oe[0] == ':' && !(oe[1] == '/' && oe[2] == '/'))
- /*@innerbreak@*/ break;
+ break;
}
if (oe && *oe)
*oe++ = '\0';
@@ -331,8 +317,8 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
/* Find key in option table. */
for (opt = rdbOptions; opt->longName != NULL; opt++) {
if (strcmp(tok, opt->longName))
- /*@innercontinue@*/ continue;
- /*@innerbreak@*/ break;
+ continue;
+ break;
}
if (opt->longName == NULL) {
rpmError(RPMERR_DBCONFIG,
@@ -350,21 +336,18 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
case POPT_ARG_NONE:
(void) poptSaveInt((int *)opt->arg, argInfo, 1L);
- /*@switchbreak@*/ break;
+ break;
case POPT_ARG_VAL:
(void) poptSaveInt((int *)opt->arg, argInfo, (long)opt->val);
- /*@switchbreak@*/ break;
+ break;
case POPT_ARG_STRING:
{ const char ** t = opt->arg;
- /*@-mods@*/
if (t) {
-/*@-unqualifiedtrans@*/ /* FIX: opt->arg annotation in popt.h */
+/* FIX: opt->arg annotation in popt.h */
*t = _free(*t);
-/*@=unqualifiedtrans@*/
*t = xstrdup( (p ? p : "") );
}
- /*@=mods@*/
- } /*@switchbreak@*/ break;
+ } break;
case POPT_ARG_INT:
case POPT_ARG_LONG:
@@ -390,7 +373,7 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
continue;
}
(void) poptSaveLong((long *)opt->arg, argInfo, aLong);
- /*@switchbreak@*/ break;
+ break;
} else {
if (aLong > INT_MAX || aLong < INT_MIN) {
rpmError(RPMERR_DBCONFIG,
@@ -400,34 +383,29 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
}
(void) poptSaveInt((int *)opt->arg, argInfo, aLong);
}
- } /*@switchbreak@*/ break;
+ } break;
default:
- /*@switchbreak@*/ break;
+ break;
}
}
/*=========*/
}
- /*@=branchstate@*/
dbOpts = _free(dbOpts);
- /*@-assignexpose@*/
-/*@i@*/ *dbi = db3dbi; /* structure assignment */
- /*@=assignexpose@*/
+ *dbi = db3dbi; /* structure assignment */
memset(&db3dbi, 0, sizeof(db3dbi));
if (!(dbi->dbi_perms & 0600))
dbi->dbi_perms = 0644;
dbi->dbi_mode = rpmdb->db_mode;
- /*@-assignexpose -newreftrans@*/ /* FIX: figger rpmdb/dbi refcounts */
-/*@i@*/ dbi->dbi_rpmdb = rpmdb;
- /*@=assignexpose =newreftrans@*/
+ /* FIX: figger rpmdb/dbi refcounts */
+ dbi->dbi_rpmdb = rpmdb;
dbi->dbi_rpmtag = rpmtag;
/*
* Inverted lists have join length of 2, primary data has join length of 1.
*/
- /*@-sizeoftype@*/
switch (rpmtag) {
case RPMDBI_PACKAGES:
case RPMDBI_DEPENDS:
@@ -437,7 +415,6 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
dbi->dbi_jlen = 2 * sizeof(int_32);
break;
}
- /*@=sizeoftype@*/
dbi->dbi_byteswapped = -1; /* -1 unknown, 0 native order, 1 alien order */
@@ -451,13 +428,10 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
if ((dbi->dbi_bt_flags | dbi->dbi_h_flags) & DB_DUP)
dbi->dbi_permit_dups = 1;
- /*@-globstate@*/ /* FIX: *(rdbOptions->arg) reachable */
+ /* FIX: *(rdbOptions->arg) reachable */
return dbi;
- /*@=globstate@*/
}
-/*@=bounds@*/
-/*@-boundswrite@*/
const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
{
static char buf[256];
@@ -492,6 +466,5 @@ const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
}
return buf;
}
-/*@=boundswrite@*/
#endif
diff --git a/rpmdb/fprint.c b/rpmdb/fprint.c
index 1d5bf40fd..e1e1893ae 100644
--- a/rpmdb/fprint.c
+++ b/rpmdb/fprint.c
@@ -33,18 +33,15 @@ fingerPrintCache fpCacheFree(fingerPrintCache cache)
* @param dirName string to locate in cache
* @return pointer to directory name entry (or NULL if not found).
*/
-static /*@null@*/ const struct fprintCacheEntry_s * cacheContainsDirectory(
+static const struct fprintCacheEntry_s * cacheContainsDirectory(
fingerPrintCache cache,
const char * dirName)
- /*@*/
{
const void ** data;
if (htGetEntry(cache->ht, dirName, &data, NULL, NULL))
return NULL;
-/*@-boundsread@*/
return data[0];
-/*@=boundsread@*/
}
/**
@@ -55,10 +52,9 @@ static /*@null@*/ const struct fprintCacheEntry_s * cacheContainsDirectory(
* @param scareMemory
* @return pointer to the finger print associated with a file path.
*/
-/*@-bounds@*/ /* LCL: segfault */
+/* LCL: segfault */
static fingerPrint doLookup(fingerPrintCache cache,
const char * dirName, const char * baseName, int scareMemory)
- /*@modifies cache @*/
{
char dir[PATH_MAX];
const char * cleanDirName;
@@ -76,11 +72,9 @@ static fingerPrint doLookup(fingerPrintCache cache,
cdnl = strlen(cleanDirName);
if (*cleanDirName == '/') {
- /*@-branchstate@*/
if (!scareMemory)
cleanDirName =
rpmCleanPath(strcpy(alloca(cdnl+1), dirName));
- /*@=branchstate@*/
} else {
scareMemory = 0; /* XXX causes memory leak */
@@ -93,7 +87,6 @@ static fingerPrint doLookup(fingerPrintCache cache,
/* if the current directory doesn't exist, we might fail.
oh well. likewise if it's too long. */
dir[0] = '\0';
- /*@-branchstate@*/
if (realpath(".", dir) != NULL) {
end = dir + strlen(dir);
if (end[-1] != '/') *end++ = '/';
@@ -106,14 +99,11 @@ static fingerPrint doLookup(fingerPrintCache cache,
cleanDirName = dir;
cdnl = end - dir;
}
- /*@=branchstate@*/
}
fp.entry = NULL;
fp.subDir = NULL;
fp.baseName = NULL;
- /*@-nullret@*/
if (cleanDirName == NULL) return fp; /* XXX can't happen */
- /*@=nullret@*/
buf = strcpy(alloca(cdnl + 1), cleanDirName);
end = buf + cdnl;
@@ -136,7 +126,7 @@ static fingerPrint doLookup(fingerPrintCache cache,
char * dn = xmalloc(nb);
struct fprintCacheEntry_s * newEntry = (void *)dn;
- /*@-usereleased@*/ /* LCL: contiguous malloc confusion */
+ /* LCL: contiguous malloc confusion */
dn += sizeof(*newEntry);
strcpy(dn, (*buf != '\0' ? buf : "/"));
newEntry->ino = sb.st_ino;
@@ -144,10 +134,7 @@ static fingerPrint doLookup(fingerPrintCache cache,
newEntry->dirName = dn;
fp.entry = newEntry;
- /*@-kepttrans -dependenttrans @*/
htAddEntry(cache->ht, dn, fp.entry);
- /*@=kepttrans =dependenttrans @*/
- /*@=usereleased@*/
}
if (fp.entry) {
@@ -161,9 +148,8 @@ static fingerPrint doLookup(fingerPrintCache cache,
fp.baseName = baseName;
if (!scareMemory && fp.subDir != NULL)
fp.subDir = xstrdup(fp.subDir);
- /*@-compdef@*/ /* FIX: fp.entry.{dirName,dev,ino} undef @*/
+ /* FIX: fp.entry.{dirName,dev,ino} undef @*/
return fp;
- /*@=compdef@*/
}
/* stat of '/' just failed! */
@@ -178,13 +164,10 @@ static fingerPrint doLookup(fingerPrintCache cache,
*end = '\0';
}
- /*@notreached@*/
- /*@-compdef@*/ /* FIX: fp.entry.{dirName,dev,ino} undef @*/
- /*@-nullret@*/ return fp; /*@=nullret@*/ /* LCL: can't happen. */
- /*@=compdef@*/
+ /* FIX: fp.entry.{dirName,dev,ino} undef @*/
+ return fp; /* LCL: can't happen. */
}
-/*@=bounds@*/
fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
const char * baseName, int scareMemory)
@@ -201,9 +184,7 @@ unsigned int fpHashFunction(const void * key)
ch = 0;
chptr = fp->baseName;
-/*@-boundsread@*/
while (*chptr != '\0') ch ^= *chptr++;
-/*@=boundsread@*/
hash |= ((unsigned)ch) << 24;
hash |= (((((unsigned)fp->entry->dev) >> 8) ^ fp->entry->dev) & 0xFF) << 16;
@@ -212,7 +193,6 @@ unsigned int fpHashFunction(const void * key)
return hash;
}
-/*@-boundsread@*/
int fpEqual(const void * key1, const void * key2)
{
const fingerPrint *k1 = key1;
@@ -223,16 +203,13 @@ int fpEqual(const void * key1, const void * key2)
return 0;
/* Otherwise, compare fingerprints by value. */
- /*@-nullpass@*/ /* LCL: whines about (*k2).subdir */
+ /* LCL: whines about (*k2).subdir */
if (FP_EQUAL(*k1, *k2))
return 0;
- /*@=nullpass@*/
return 1;
}
-/*@=boundsread@*/
-/*@-bounds@*/
void fpLookupList(fingerPrintCache cache, const char ** dirNames,
const char ** baseNames, const uint_32 * dirIndexes,
int fileCount, fingerPrint * fpList)
@@ -252,7 +229,6 @@ void fpLookupList(fingerPrintCache cache, const char ** dirNames,
}
}
}
-/*@=bounds@*/
#ifdef UNUSED
/**
@@ -263,8 +239,7 @@ void fpLookupList(fingerPrintCache cache, const char ** dirNames,
* @retval fpList pointer to array of finger prints
*/
static
-void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
- /*@modifies h, cache, *fpList @*/;
+void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList);
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
diff --git a/rpmdb/fprint.h b/rpmdb/fprint.h
index 09ef526f3..33c0a9c37 100644
--- a/rpmdb/fprint.h
+++ b/rpmdb/fprint.h
@@ -11,7 +11,7 @@
/**
*/
-typedef /*@abstract@*/ struct fprintCache_s * fingerPrintCache;
+typedef struct fprintCache_s * fingerPrintCache;
/**
* @todo Convert to pointer and make abstract.
@@ -45,8 +45,8 @@ struct fingerPrint_s {
/*! directory finger print entry (the directory path is stat(2)-able */
const struct fprintCacheEntry_s * entry;
/*! trailing sub-directory path (directories that are not stat(2)-able */
-/*@owned@*/ /*@null@*/ const char * subDir;
-/*@dependent@*/ const char * baseName; /*!< file base name */
+const char * subDir;
+const char * baseName; /*!< file base name */
};
/** */
@@ -73,11 +73,8 @@ extern "C" {
* @param numItems number of fingerprint items
* @return 0 always
*/
-int rpmdbFindFpList(/*@null@*/ rpmdb db, fingerPrint * fpList,
- /*@out@*/ dbiIndexSet * matchList, int numItems)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, *matchList, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+int rpmdbFindFpList(rpmdb db, fingerPrint * fpList,
+ dbiIndexSet * matchList, int numItems);
/* Be carefull with the memory... assert(*fullName == '/' || !scareMemory) */
@@ -86,17 +83,14 @@ int rpmdbFindFpList(/*@null@*/ rpmdb db, fingerPrint * fpList,
* @param sizeHint number of elements expected
* @return pointer to initialized fingerprint cache
*/
-/*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint)
- /*@*/;
+fingerPrintCache fpCacheCreate(int sizeHint);
/**
* Destroy finger print cache.
* @param cache pointer to fingerprint cache
* @return NULL always
*/
-/*@null@*/
-fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
- /*@modifies cache @*/;
+fingerPrintCache fpCacheFree(fingerPrintCache cache);
/**
* Return finger print of a file path.
@@ -107,8 +101,7 @@ fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
* @return pointer to the finger print associated with a file path.
*/
fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
- const char * baseName, int scareMemory)
- /*@modifies cache @*/;
+ const char * baseName, int scareMemory);
/**
* Return hash value for a finger print.
@@ -116,8 +109,7 @@ fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
* @param key pointer to finger print entry
* @return hash value
*/
-unsigned int fpHashFunction(const void * key)
- /*@*/;
+unsigned int fpHashFunction(const void * key);
/**
* Compare two finger print entries.
@@ -126,8 +118,7 @@ unsigned int fpHashFunction(const void * key)
* @param key2 finger print 2
* @return result of comparing key1 and key2
*/
-int fpEqual(const void * key1, const void * key2)
- /*@*/;
+int fpEqual(const void * key1, const void * key2);
/**
* Return finger prints of an array of file paths.
@@ -141,8 +132,7 @@ int fpEqual(const void * key1, const void * key2)
*/
void fpLookupList(fingerPrintCache cache, const char ** dirNames,
const char ** baseNames, const uint_32 * dirIndexes,
- int fileCount, fingerPrint * fpList)
- /*@modifies cache, *fpList @*/;
+ int fileCount, fingerPrint * fpList);
#ifdef __cplusplus
}
diff --git a/rpmdb/hdrNVR.c b/rpmdb/hdrNVR.c
index d69978152..58bea867d 100644
--- a/rpmdb/hdrNVR.c
+++ b/rpmdb/hdrNVR.c
@@ -11,7 +11,6 @@ int headerNVR(Header h, const char **np, const char **vp, const char **rp)
int type;
int count;
-/*@-boundswrite@*/
if (np) {
if (!(headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count)
&& type == RPM_STRING_TYPE && count == 1))
@@ -27,18 +26,16 @@ int headerNVR(Header h, const char **np, const char **vp, const char **rp)
&& type == RPM_STRING_TYPE && count == 1))
*rp = NULL;
}
-/*@=boundswrite@*/
return 0;
}
int headerNEVRA(Header h, const char **np,
- /*@unused@*/ const char **ep, const char **vp, const char **rp,
+ const char **ep, const char **vp, const char **rp,
const char **ap)
{
int type;
int count;
-/*@-boundswrite@*/
if (np) {
if (!(headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count)
&& type == RPM_STRING_TYPE && count == 1))
@@ -59,6 +56,5 @@ int headerNEVRA(Header h, const char **np,
&& type == RPM_STRING_TYPE && count == 1))
*ap = NULL;
}
-/*@=boundswrite@*/
return 0;
}
diff --git a/rpmdb/hdrinline.h b/rpmdb/hdrinline.h
index 40d6d050c..163ba862f 100644
--- a/rpmdb/hdrinline.h
+++ b/rpmdb/hdrinline.h
@@ -1,4 +1,4 @@
-/*@-type@*/ /* FIX: cast to HV_t bogus */
+/* FIX: cast to HV_t bogus */
#ifndef H_HDRINLINE
#define H_HDRINLINE
@@ -9,31 +9,25 @@
#ifdef __cplusplus
extern "C" {
#endif
-/*@+voidabstract -nullpass -mustmod -compdef -shadow -predboolothers @*/
/** \ingroup header
* Header methods for rpm headers.
*/
-/*@observer@*/ /*@unchecked@*/
extern struct HV_s * hdrVec;
/** \ingroup header
*/
-/*@unused@*/ static inline HV_t h2hv(Header h)
- /*@*/
+static inline HV_t h2hv(Header h)
{
- /*@-abstract -castexpose -refcounttrans@*/
return ((HV_t)h);
- /*@=abstract =castexpose =refcounttrans@*/
}
/** \ingroup header
* Create new (empty) header instance.
* @return header
*/
-/*@unused@*/ static inline
+static inline
Header headerNew(void)
- /*@*/
{
return hdrVec->hdrnew();
}
@@ -43,13 +37,10 @@ Header headerNew(void)
* @param h header
* @return NULL always
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerFree( /*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/
+static inline
+Header headerFree( Header h)
{
- /*@-abstract@*/
if (h == NULL) return NULL;
- /*@=abstract@*/
return (h2hv(h)->hdrfree) (h);
}
@@ -58,9 +49,8 @@ Header headerNew(void)
* @param h header
* @return new header reference
*/
-/*@unused@*/ static inline
+static inline
Header headerLink(Header h)
- /*@modifies h @*/
{
return (h2hv(h)->hdrlink) (h);
}
@@ -70,28 +60,22 @@ Header headerLink(Header h)
* @param h header
* @return new header reference
*/
-/*@unused@*/ static inline
-Header headerUnlink(/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/
+static inline
+Header headerUnlink(Header h)
{
- /*@-abstract@*/
if (h == NULL) return NULL;
- /*@=abstract@*/
return (h2hv(h)->hdrunlink) (h);
}
-/*@-exportlocal@*/
/** \ingroup header
* Sort tags in header.
* @param h header
*/
-/*@unused@*/ static inline
+static inline
void headerSort(Header h)
- /*@modifies h @*/
{
-/*@-noeffectuncon@*/ /* FIX: add rc */
+/* FIX: add rc */
(h2hv(h)->hdrsort) (h);
-/*@=noeffectuncon@*/
return;
}
@@ -99,16 +83,13 @@ void headerSort(Header h)
* Restore tags in header to original ordering.
* @param h header
*/
-/*@unused@*/ static inline
+static inline
void headerUnsort(Header h)
- /*@modifies h @*/
{
-/*@-noeffectuncon@*/ /* FIX: add rc */
+/* FIX: add rc */
(h2hv(h)->hdrunsort) (h);
-/*@=noeffectuncon@*/
return;
}
-/*@=exportlocal@*/
/** \ingroup header
* Return size of on-disk header representation in bytes.
@@ -116,13 +97,10 @@ void headerUnsort(Header h)
* @param magicp include size of 8 bytes for (magic, 0)?
* @return size of on-disk header
*/
-/*@unused@*/ static inline
-unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
- /*@modifies h @*/
+static inline
+unsigned int headerSizeof(Header h, enum hMagic magicp)
{
- /*@-abstract@*/
if (h == NULL) return 0;
- /*@=abstract@*/
return (h2hv(h)->hdrsizeof) (h, magicp);
}
@@ -131,9 +109,8 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
* @param h header (with pointers)
* @return on-disk header blob (i.e. with offsets)
*/
-/*@unused@*/ static inline
-/*@only@*/ /*@null@*/ void * headerUnload(Header h)
- /*@modifies h @*/
+static inline
+void * headerUnload(Header h)
{
return (h2hv(h)->hdrunload) (h);
}
@@ -145,13 +122,10 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
* @param tag region tag
* @return on-disk header (with offsets)
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerReload(/*@only@*/ Header h, int tag)
- /*@modifies h @*/
+static inline
+Header headerReload(Header h, int tag)
{
- /*@-onlytrans@*/
return (h2hv(h)->hdrreload) (h, tag);
- /*@=onlytrans@*/
}
/** \ingroup header
@@ -159,9 +133,8 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
* @param h header
* @return new header instance
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerCopy(Header h)
- /*@modifies h @*/
+static inline
+Header headerCopy(Header h)
{
return (h2hv(h)->hdrcopy) (h);
}
@@ -171,9 +144,8 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerLoad(/*@kept@*/ void * uh)
- /*@modifies uh @*/
+static inline
+Header headerLoad(void * uh)
{
return hdrVec->hdrload(uh);
}
@@ -183,9 +155,8 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerCopyLoad(const void * uh)
- /*@*/
+static inline
+Header headerCopyLoad(const void * uh)
{
return hdrVec->hdrcopyload(uh);
}
@@ -196,9 +167,8 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
* @param magicp read (and verify) 8 bytes of (magic, 0)?
* @return header (or NULL on error)
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerRead(FD_t fd, enum hMagic magicp)
- /*@modifies fd @*/
+static inline
+Header headerRead(FD_t fd, enum hMagic magicp)
{
return hdrVec->hdrread(fd, magicp);
}
@@ -210,13 +180,10 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
* @param magicp prefix write with 8 bytes of (magic, 0)?
* @return 0 on success, 1 on error
*/
-/*@unused@*/ static inline
-int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
- /*@modifies fd, h @*/
+static inline
+int headerWrite(FD_t fd, Header h, enum hMagic magicp)
{
- /*@-abstract@*/
if (h == NULL) return 0;
- /*@=abstract@*/
return (h2hv(h)->hdrwrite) (fd, h, magicp);
}
@@ -226,13 +193,10 @@ int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
* @param tag tag
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
-int headerIsEntry(/*@null@*/ Header h, int_32 tag)
- /*@modifies h @*/
+static inline
+int headerIsEntry(Header h, int_32 tag)
{
- /*@-abstract@*/
if (h == NULL) return 0;
- /*@=abstract@*/
return (h2hv(h)->hdrisentry) (h, tag);
}
@@ -243,10 +207,9 @@ int headerIsEntry(/*@null@*/ Header h, int_32 tag)
* @param type type of data (or -1 to force free)
* @return NULL always
*/
-/*@unused@*/ static inline
-/*@null@*/ void * headerFreeTag(Header h,
- /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
- /*@modifies data @*/
+static inline
+void * headerFreeTag(Header h,
+ const void * data, rpmTagType type)
{
return (h2hv(h)->hdrfreetag) (h, data, type);
}
@@ -264,12 +227,11 @@ int headerIsEntry(/*@null@*/ Header h, int_32 tag)
* @retval *c number of values (or NULL)
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerGetEntry(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void ** p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/
+ hTYP_t type,
+ void ** p,
+ hCNT_t c)
{
return (h2hv(h)->hdrget) (h, tag, type, p, c);
}
@@ -286,12 +248,11 @@ int headerGetEntry(Header h, int_32 tag,
* @retval *c number of values (or NULL)
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerGetEntryMinMemory(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c)
{
return (h2hv(h)->hdrgetmin) (h, tag, type, p, c);
}
@@ -310,10 +271,8 @@ int headerGetEntryMinMemory(Header h, int_32 tag,
* @param c number of values
* @return 1 on success, 0 on failure
*/
-/*@mayexit@*/
-/*@unused@*/ static inline
+static inline
int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/
{
return (h2hv(h)->hdradd) (h, tag, type, p, c);
}
@@ -332,10 +291,9 @@ int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
* @param c number of values
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
return (h2hv(h)->hdrappend) (h, tag, type, p, c);
}
@@ -350,10 +308,9 @@ int headerAppendEntry(Header h, int_32 tag, int_32 type,
* @param c number of values
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
return (h2hv(h)->hdraddorappend) (h, tag, type, p, c);
}
@@ -378,10 +335,9 @@ int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
* @param lang locale
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerAddI18NString(Header h, int_32 tag, const char * string,
const char * lang)
- /*@modifies h @*/
{
return (h2hv(h)->hdraddi18n) (h, tag, string, lang);
}
@@ -396,10 +352,9 @@ int headerAddI18NString(Header h, int_32 tag, const char * string,
* @param c number of values
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerModifyEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
return (h2hv(h)->hdrmodify) (h, tag, type, p, c);
}
@@ -413,9 +368,8 @@ int headerModifyEntry(Header h, int_32 tag, int_32 type,
* @param tag tag
* @return 0 on success, 1 on failure (INCONSISTENT)
*/
-/*@unused@*/ static inline
+static inline
int headerRemoveEntry(Header h, int_32 tag)
- /*@modifies h @*/
{
return (h2hv(h)->hdrremove) (h, tag);
}
@@ -431,12 +385,11 @@ int headerRemoveEntry(Header h, int_32 tag)
* @retval errmsg error message (if any)
* @return formatted output string (malloc'ed)
*/
-/*@unused@*/ static inline
-/*@only@*/ char * headerSprintf(Header h, const char * fmt,
+static inline
+char * headerSprintf(Header h, const char * fmt,
const struct headerTagTableEntry_s * tbltags,
const struct headerSprintfExtension_s * extensions,
- /*@null@*/ /*@out@*/ errmsg_t * errmsg)
- /*@modifies *errmsg @*/
+ errmsg_t * errmsg)
{
return (h2hv(h)->hdrsprintf) (h, fmt, tbltags, extensions, errmsg);
}
@@ -447,13 +400,11 @@ int headerRemoveEntry(Header h, int_32 tag)
* @param headerTo destination header
* @param tagstocopy array of tags that are copied
*/
-/*@unused@*/ static inline
+static inline
void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
- /*@modifies headerFrom, headerTo @*/
{
-/*@-noeffectuncon@*/ /* FIX: add rc */
+/* FIX: add rc */
hdrVec->hdrcopytags(headerFrom, headerTo, tagstocopy);
-/*@=noeffectuncon@*/
return;
}
@@ -462,9 +413,8 @@ void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
* @param hi header tag iterator
* @return NULL always
*/
-/*@unused@*/ static inline
-HeaderIterator headerFreeIterator(/*@only@*/ HeaderIterator hi)
- /*@modifies hi @*/
+static inline
+HeaderIterator headerFreeIterator(HeaderIterator hi)
{
return hdrVec->hdrfreeiter(hi);
}
@@ -474,9 +424,8 @@ HeaderIterator headerFreeIterator(/*@only@*/ HeaderIterator hi)
* @param h header
* @return header tag iterator
*/
-/*@unused@*/ static inline
+static inline
HeaderIterator headerInitIterator(Header h)
- /*@modifies h */
{
return hdrVec->hdrinititer(h);
}
@@ -490,22 +439,19 @@ HeaderIterator headerInitIterator(Header h)
* @retval *c number of values
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerNextIterator(HeaderIterator hi,
- /*@null@*/ /*@out@*/ hTAG_t tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies hi, *tag, *type, *p, *c @*/
+ hTAG_t tag,
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c)
{
return hdrVec->hdrnextiter(hi, tag, type, p, c);
}
-/*@=voidabstract =nullpass =mustmod =compdef =shadow =predboolothers @*/
#ifdef __cplusplus
}
#endif
#endif /* H_HDRINLINE */
-/*@=type@*/
diff --git a/rpmdb/header.c b/rpmdb/header.c
index 97e7d0245..cd1d7df29 100644
--- a/rpmdb/header.c
+++ b/rpmdb/header.c
@@ -16,16 +16,9 @@
#include "debug.h"
-/*@unchecked@*/
int _hdr_debug = 0;
-/*@access entryInfo @*/
-/*@access indexEntry @*/
-/*@access rpmec @*/
-/*@access sprintfTag @*/
-/*@access sprintfToken @*/
-/*@access HV_t @*/
#define PARSER_BEGIN 0
#define PARSER_IN_ARRAY 1
@@ -33,7 +26,6 @@ int _hdr_debug = 0;
/** \ingroup header
*/
-/*@observer@*/ /*@unchecked@*/
static unsigned char header_magic[8] = {
0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
};
@@ -41,7 +33,6 @@ static unsigned char header_magic[8] = {
/** \ingroup header
* Alignment needed for header data types.
*/
-/*@observer@*/ /*@unchecked@*/
static int typeAlign[16] = {
1, /*!< RPM_NULL_TYPE */
1, /*!< RPM_CHAR_TYPE */
@@ -64,7 +55,6 @@ static int typeAlign[16] = {
/** \ingroup header
* Size of header data types.
*/
-/*@observer@*/ /*@unchecked@*/
static int typeSizes[16] = {
0, /*!< RPM_NULL_TYPE */
1, /*!< RPM_CHAR_TYPE */
@@ -87,7 +77,6 @@ static int typeSizes[16] = {
/** \ingroup header
* Maximum no. of bytes permitted in a header.
*/
-/*@unchecked@*/
static size_t headerMaxbytes = (32*1024*1024);
/**
@@ -117,7 +106,6 @@ static size_t headerMaxbytes = (32*1024*1024);
*/
#define hdrchkRange(_dl, _off) ((_off) < 0 || (_off) > (_dl))
-/*@observer@*/ /*@unchecked@*/
HV_t hdrVec; /* forward reference */
/**
@@ -125,8 +113,8 @@ HV_t hdrVec; /* forward reference */
* @param p memory to free
* @return NULL always
*/
-/*@unused@*/ static inline /*@null@*/ void *
-_free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies *p @*/
+static inline void *
+_free(const void * p)
{
if (p != NULL) free((void *)p);
return NULL;
@@ -139,21 +127,14 @@ _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies *p @*/
*/
static
Header headerLink(Header h)
- /*@modifies h @*/
{
-/*@-nullret@*/
if (h == NULL) return NULL;
-/*@=nullret@*/
h->nrefs++;
-/*@-modfilesys@*/
if (_hdr_debug)
fprintf(stderr, "--> h %p ++ %d at %s:%u\n", h, h->nrefs, __FILE__, __LINE__);
-/*@=modfilesys@*/
- /*@-refcounttrans @*/
return h;
- /*@=refcounttrans @*/
}
/** \ingroup header
@@ -161,15 +142,12 @@ fprintf(stderr, "--> h %p ++ %d at %s:%u\n", h, h->nrefs, __FILE__, __LINE__);
* @param h header
* @return NULL always
*/
-static /*@null@*/
-Header headerUnlink(/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/
+static
+Header headerUnlink(Header h)
{
if (h == NULL) return NULL;
-/*@-modfilesys@*/
if (_hdr_debug)
fprintf(stderr, "--> h %p -- %d at %s:%u\n", h, h->nrefs, __FILE__, __LINE__);
-/*@=modfilesys@*/
h->nrefs--;
return NULL;
}
@@ -179,13 +157,11 @@ fprintf(stderr, "--> h %p -- %d at %s:%u\n", h, h->nrefs, __FILE__, __LINE__);
* @param h header
* @return NULL always
*/
-static /*@null@*/
-Header headerFree(/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/
+static
+Header headerFree(Header h)
{
(void) headerUnlink(h);
- /*@-usereleased@*/
if (h == NULL || h->nrefs > 0)
return NULL; /* XXX return previous header? */
@@ -207,9 +183,8 @@ Header headerFree(/*@killref@*/ /*@null@*/ Header h)
h->index = _free(h->index);
}
- /*@-refcounttrans@*/ h = _free(h); /*@=refcounttrans@*/
+ h = _free(h);
return h;
- /*@=usereleased@*/
}
/** \ingroup header
@@ -218,15 +193,10 @@ Header headerFree(/*@killref@*/ /*@null@*/ Header h)
*/
static
Header headerNew(void)
- /*@*/
{
Header h = xcalloc(1, sizeof(*h));
-/*@-boundsread@*/
- /*@-assignexpose@*/
h->hv = *hdrVec; /* structure assignment */
- /*@=assignexpose@*/
-/*@=boundsread@*/
h->blob = NULL;
h->indexAlloced = INDEX_MALLOC_SIZE;
h->indexUsed = 0;
@@ -237,19 +207,14 @@ Header headerNew(void)
: NULL);
h->nrefs = 0;
- /*@-globstate -observertrans @*/
return headerLink(h);
- /*@=globstate =observertrans @*/
}
/**
*/
static int indexCmp(const void * avp, const void * bvp)
- /*@*/
{
- /*@-castexpose@*/
indexEntry ap = (indexEntry) avp, bp = (indexEntry) bvp;
- /*@=castexpose@*/
return (ap->info.tag - bp->info.tag);
}
@@ -259,23 +224,18 @@ static int indexCmp(const void * avp, const void * bvp)
*/
static
void headerSort(Header h)
- /*@modifies h @*/
{
if (!(h->flags & HEADERFLAG_SORTED)) {
-/*@-boundsread@*/
qsort(h->index, h->indexUsed, sizeof(*h->index), indexCmp);
-/*@=boundsread@*/
h->flags |= HEADERFLAG_SORTED;
}
}
/**
*/
-static int offsetCmp(const void * avp, const void * bvp) /*@*/
+static int offsetCmp(const void * avp, const void * bvp)
{
- /*@-castexpose@*/
indexEntry ap = (indexEntry) avp, bp = (indexEntry) bvp;
- /*@=castexpose@*/
int rc = (ap->info.offset - bp->info.offset);
if (rc == 0) {
@@ -294,11 +254,8 @@ static int offsetCmp(const void * avp, const void * bvp) /*@*/
*/
static
void headerUnsort(Header h)
- /*@modifies h @*/
{
-/*@-boundsread@*/
qsort(h->index, h->indexUsed, sizeof(*h->index), offsetCmp);
-/*@=boundsread@*/
}
/** \ingroup header
@@ -308,8 +265,7 @@ void headerUnsort(Header h)
* @return size of on-disk header
*/
static
-unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
- /*@modifies h @*/
+unsigned int headerSizeof(Header h, enum hMagic magicp)
{
indexEntry entry;
unsigned int size = 0;
@@ -329,9 +285,7 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
break;
}
- /*@-sizeoftype@*/
size += 2 * sizeof(int_32); /* count of index entries */
- /*@=sizeoftype@*/
for (i = 0, entry = h->index; i < h->indexUsed; i++, entry++) {
unsigned diff;
@@ -341,10 +295,8 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
if (ENTRY_IS_REGION(entry)) {
size += entry->length;
/* XXX Legacy regions do not include the region tag and data. */
- /*@-sizeoftype@*/
if (i == 0 && (h->flags & HEADERFLAG_LEGACY))
size += sizeof(struct entryInfo_s) + entry->info.count;
- /*@=sizeoftype@*/
continue;
}
@@ -354,7 +306,6 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
/* Alignment */
type = entry->info.type;
-/*@-boundsread@*/
if (typeSizes[type] > 1) {
diff = typeSizes[type] - (size % typeSizes[type]);
if (diff != typeSizes[type]) {
@@ -362,11 +313,8 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
pad += diff;
}
}
-/*@=boundsread@*/
- /*@-sizeoftype@*/
size += sizeof(struct entryInfo_s) + entry->length;
- /*@=sizeoftype@*/
}
return size;
@@ -382,8 +330,7 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
* @return no. bytes in data, -1 on failure
*/
static int dataLength(int_32 type, hPTR_t p, int_32 count, int onDisk,
- /*@null@*/ hPTR_t pend)
- /*@*/
+ hPTR_t pend)
{
const unsigned char * s = p;
const unsigned char * se = pend;
@@ -393,13 +340,11 @@ static int dataLength(int_32 type, hPTR_t p, int_32 count, int onDisk,
case RPM_STRING_TYPE:
if (count != 1)
return -1;
-/*@-boundsread@*/
while (*s++) {
if (se && s > se)
return -1;
length++;
}
-/*@=boundsread@*/
length++; /* count nul terminator too. */
break;
@@ -411,31 +356,25 @@ static int dataLength(int_32 type, hPTR_t p, int_32 count, int onDisk,
if (onDisk) {
while (count--) {
length++; /* count nul terminator too */
-/*@-boundsread@*/
while (*s++) {
if (se && s > se)
return -1;
length++;
}
-/*@=boundsread@*/
}
} else {
const char ** av = (const char **)p;
-/*@-boundsread@*/
while (count--) {
/* add one for null termination */
length += strlen(*av++) + 1;
}
-/*@=boundsread@*/
}
break;
default:
-/*@-boundsread@*/
if (typeSizes[type] == -1)
return -1;
length = typeSizes[(type & 0xf)] * count;
-/*@=boundsread@*/
if (length < 0 || (se && (s + length) > se))
return -1;
break;
@@ -470,12 +409,11 @@ static int dataLength(int_32 type, hPTR_t p, int_32 count, int onDisk,
* @param regionid region offset
* @return no. bytes of data in region, -1 on error
*/
-static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
+static int regionSwab(indexEntry entry, int il, int dl,
entryInfo pe,
unsigned char * dataStart,
- /*@null@*/ const unsigned char * dataEnd,
+ const unsigned char * dataEnd,
int regionid)
- /*@modifies *entry, *dataStart @*/
{
unsigned char * tprev = NULL;
unsigned char * t = NULL;
@@ -483,9 +421,7 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
int tl = dl;
struct indexEntry_s ieprev;
-/*@-boundswrite@*/
memset(&ieprev, 0, sizeof(ieprev));
-/*@=boundswrite@*/
for (; il > 0; il--, pe++) {
struct indexEntry_s ie;
int_32 type;
@@ -501,10 +437,8 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
return -1;
if (hdrchkData(ie.info.offset))
return -1;
-/*@-boundsread@*/
if (hdrchkAlign(ie.info.type, ie.info.offset))
return -1;
-/*@=boundsread@*/
ie.data = t = dataStart + ie.info.offset;
if (dataEnd && t >= dataEnd)
@@ -518,15 +452,12 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
if (entry) {
ie.info.offset = regionid;
-/*@-boundswrite@*/
*entry = ie; /* structure assignment */
-/*@=boundswrite@*/
entry++;
}
/* Alignment */
type = ie.info.type;
-/*@-boundsread@*/
if (typeSizes[type] > 1) {
unsigned diff;
diff = typeSizes[type] - (dl % typeSizes[type]);
@@ -536,7 +467,6 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
ieprev.length += diff;
}
}
-/*@=boundsread@*/
tdel = (tprev ? (t - tprev) : 0);
if (ieprev.info.type == RPM_I18NSTRING_TYPE)
tdel = ieprev.length;
@@ -546,15 +476,12 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
} else {
tprev = dataStart;
/* XXX HEADER_IMAGE tags don't include region sub-tag. */
- /*@-sizeoftype@*/
if (ie.info.tag == HEADER_IMAGE)
tprev -= REGION_TAG_COUNT;
- /*@=sizeoftype@*/
}
/* Perform endian conversions */
switch (ntohl(pe->type)) {
-/*@-bounds@*/
case RPM_INT32_TYPE:
{ int_32 * it = (int_32 *)t;
for (; ie.info.count > 0; ie.info.count--, it += 1) {
@@ -563,7 +490,7 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
*it = htonl(*it);
}
t = (unsigned char *) it;
- } /*@switchbreak@*/ break;
+ } break;
case RPM_INT16_TYPE:
{ int_16 * it = (int_16 *) t;
for (; ie.info.count > 0; ie.info.count--, it += 1) {
@@ -572,11 +499,10 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
*it = htons(*it);
}
t = (unsigned char *) it;
- } /*@switchbreak@*/ break;
-/*@=bounds@*/
+ } break;
default:
t += ie.length;
- /*@switchbreak@*/ break;
+ break;
}
dl += ie.length;
@@ -592,10 +518,8 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
* 1) tl is 16b (i.e. REGION_TAG_COUNT) short while doing headerReload().
* 2) the 8/98 rpm bug with inserting i18n tags needs to use tl, not dl.
*/
- /*@-sizeoftype@*/
if (tl+REGION_TAG_COUNT == dl)
tl += REGION_TAG_COUNT;
- /*@=sizeoftype@*/
return dl;
}
@@ -605,11 +529,8 @@ static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
* @retval *lengthPtr no. bytes in unloaded header blob
* @return unloaded header blob (NULL on error)
*/
-static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h,
- /*@out@*/ int * lengthPtr)
- /*@modifies h, *lengthPtr @*/
- /*@requires maxSet(lengthPtr) >= 0 @*/
- /*@ensures maxRead(result) == (*lengthPtr) @*/
+static void * doHeaderUnload(Header h,
+ int * lengthPtr)
{
int_32 * ei = NULL;
entryInfo pe;
@@ -647,7 +568,7 @@ static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h,
/* Skip rest of entries in region, but account for dribbles. */
for (; i < h->indexUsed && entry->info.offset <= rid+1; i++, entry++) {
if (entry->info.offset <= rid)
- /*@innercontinue@*/ continue;
+ continue;
/* Alignment */
type = entry->info.type;
@@ -700,11 +621,9 @@ static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h,
len = sizeof(il) + sizeof(dl) + (il * sizeof(*pe)) + dl;
-/*@-boundswrite@*/
ei = xmalloc(len);
ei[0] = htonl(il);
ei[1] = htonl(dl);
-/*@=boundswrite@*/
pe = (entryInfo) &ei[2];
dataStart = te = (char *) (pe + il);
@@ -737,10 +656,8 @@ static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h,
int_32 stei[4];
legacy = 1;
-/*@-boundswrite@*/
memcpy(pe+1, src, rdl);
memcpy(te, src + rdl, rdlen);
-/*@=boundswrite@*/
te += rdlen;
pe->offset = htonl(te - dataStart);
@@ -748,9 +665,7 @@ static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h,
stei[1] = pe->type;
stei[2] = htonl(-rdl-entry->info.count);
stei[3] = pe->count;
-/*@-boundswrite@*/
memcpy(te, stei, entry->info.count);
-/*@=boundswrite@*/
te += entry->info.count;
ril++;
rdlen += entry->info.count;
@@ -761,14 +676,11 @@ static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h,
} else {
-/*@-boundswrite@*/
memcpy(pe+1, src + sizeof(*pe), ((ril-1) * sizeof(*pe)));
memcpy(te, src + (ril * sizeof(*pe)), rdlen+entry->info.count+drlen);
-/*@=boundswrite@*/
te += rdlen;
- { /*@-castexpose@*/
+ {
entryInfo se = (entryInfo)src;
- /*@=castexpose@*/
int off = ntohl(se->offset);
pe->offset = (off) ? htonl(te - dataStart) : htonl(off);
}
@@ -800,9 +712,7 @@ static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h,
unsigned diff;
diff = typeSizes[type] - ((te - dataStart) % typeSizes[type]);
if (diff != typeSizes[type]) {
-/*@-boundswrite@*/
memset(te, 0, diff);
-/*@=boundswrite@*/
te += diff;
pad += diff;
}
@@ -811,38 +721,32 @@ static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h,
pe->offset = htonl(te - dataStart);
/* copy data w/ endian conversions */
-/*@-boundswrite@*/
switch (entry->info.type) {
case RPM_INT32_TYPE:
count = entry->info.count;
src = entry->data;
while (count--) {
*((int_32 *)te) = htonl(*((int_32 *)src));
- /*@-sizeoftype@*/
te += sizeof(int_32);
src += sizeof(int_32);
- /*@=sizeoftype@*/
}
- /*@switchbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
count = entry->info.count;
src = entry->data;
while (count--) {
*((int_16 *)te) = htons(*((int_16 *)src));
- /*@-sizeoftype@*/
te += sizeof(int_16);
src += sizeof(int_16);
- /*@=sizeoftype@*/
}
- /*@switchbreak@*/ break;
+ break;
default:
memcpy(te, entry->data, entry->length);
te += entry->length;
- /*@switchbreak@*/ break;
+ break;
}
-/*@=boundswrite@*/
pe++;
}
@@ -861,9 +765,7 @@ static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h,
return (void *) ei;
errxit:
- /*@-usereleased@*/
ei = _free(ei);
- /*@=usereleased@*/
return (void *) ei;
}
@@ -872,14 +774,11 @@ errxit:
* @param h header (with pointers)
* @return on-disk header blob (i.e. with offsets)
*/
-static /*@only@*/ /*@null@*/
+static
void * headerUnload(Header h)
- /*@modifies h @*/
{
int length;
-/*@-boundswrite@*/
void * uh = doHeaderUnload(h, &length);
-/*@=boundswrite@*/
return uh;
}
@@ -890,9 +789,8 @@ void * headerUnload(Header h)
* @param type entry type
* @return header entry
*/
-static /*@null@*/
-indexEntry findEntry(/*@null@*/ Header h, int_32 tag, int_32 type)
- /*@modifies h @*/
+static
+indexEntry findEntry(Header h, int_32 tag, int_32 type)
{
indexEntry entry, entry2, last;
struct indexEntry_s key;
@@ -902,10 +800,8 @@ indexEntry findEntry(/*@null@*/ Header h, int_32 tag, int_32 type)
key.info.tag = tag;
-/*@-boundswrite@*/
entry2 = entry =
bsearch(&key, h->index, h->indexUsed, sizeof(*h->index), indexCmp);
-/*@=boundswrite@*/
if (entry == NULL)
return NULL;
@@ -920,10 +816,9 @@ indexEntry findEntry(/*@null@*/ Header h, int_32 tag, int_32 type)
return entry;
last = h->index + h->indexUsed;
- /*@-usereleased@*/ /* FIX: entry2 = entry. Code looks bogus as well. */
+ /* FIX: entry2 = entry. Code looks bogus as well. */
while (entry2->info.tag == tag && entry2->info.type != type &&
entry2 < last) entry2++;
- /*@=usereleased@*/
if (entry->info.tag == tag && entry->info.type == type)
return entry;
@@ -942,7 +837,6 @@ indexEntry findEntry(/*@null@*/ Header h, int_32 tag, int_32 type)
*/
static
int headerRemoveEntry(Header h, int_32 tag)
- /*@modifies h @*/
{
indexEntry last = h->index + h->indexUsed;
indexEntry entry, first;
@@ -972,10 +866,8 @@ int headerRemoveEntry(Header h, int_32 tag)
if (ne > 0) {
h->indexUsed -= ne;
ne = last - first;
-/*@-boundswrite@*/
if (ne > 0)
memmove(entry, first, (ne * sizeof(*entry)));
-/*@=boundswrite@*/
}
return 0;
@@ -986,17 +878,14 @@ int headerRemoveEntry(Header h, int_32 tag)
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
-static /*@null@*/
-Header headerLoad(/*@kept@*/ void * uh)
- /*@modifies uh @*/
+static
+Header headerLoad(void * uh)
{
int_32 * ei = (int_32 *) uh;
int_32 il = ntohl(ei[0]); /* index length */
int_32 dl = ntohl(ei[1]); /* data length */
- /*@-sizeoftype@*/
size_t pvlen = sizeof(il) + sizeof(dl) +
(il * sizeof(struct entryInfo_s)) + dl;
- /*@=sizeoftype@*/
void * pv = uh;
Header h = NULL;
entryInfo pe;
@@ -1011,19 +900,13 @@ Header headerLoad(/*@kept@*/ void * uh)
goto errxit;
ei = (int_32 *) pv;
- /*@-castexpose@*/
pe = (entryInfo) &ei[2];
- /*@=castexpose@*/
dataStart = (unsigned char *) (pe + il);
dataEnd = dataStart + dl;
h = xcalloc(1, sizeof(*h));
- /*@-assignexpose@*/
h->hv = *hdrVec; /* structure assignment */
- /*@=assignexpose@*/
- /*@-assignexpose -kepttrans@*/
h->blob = uh;
- /*@=assignexpose =kepttrans@*/
h->indexAlloced = il + 1;
h->indexUsed = il;
h->index = xcalloc(h->indexAlloced, sizeof(*h->index));
@@ -1037,14 +920,10 @@ Header headerLoad(/*@kept@*/ void * uh)
h->flags |= HEADERFLAG_LEGACY;
entry->info.type = REGION_TAG_TYPE;
entry->info.tag = HEADER_IMAGE;
- /*@-sizeoftype@*/
entry->info.count = REGION_TAG_COUNT;
- /*@=sizeoftype@*/
entry->info.offset = ((unsigned char *)pe - dataStart); /* negative offset */
- /*@-assignexpose@*/
entry->data = pe;
- /*@=assignexpose@*/
entry->length = pvlen - sizeof(il) - sizeof(dl);
rdlen = regionSwab(entry+1, il, 0, pe, dataStart, dataEnd, entry->info.offset);
#if 0 /* XXX don't check, the 8/98 i18n bug fails here. */
@@ -1073,9 +952,7 @@ Header headerLoad(/*@kept@*/ void * uh)
if (hdrchkData(off))
goto errxit;
if (off) {
-/*@-sizeoftype@*/
size_t nb = REGION_TAG_COUNT;
-/*@=sizeoftype@*/
int_32 * stei = memcpy(alloca(nb), dataStart + off, nb);
rdl = -ntohl(stei[2]); /* negative offset */
ril = rdl/sizeof(*pe);
@@ -1084,17 +961,13 @@ Header headerLoad(/*@kept@*/ void * uh)
entry->info.tag = htonl(pe->tag);
} else {
ril = il;
- /*@-sizeoftype@*/
rdl = (ril * sizeof(struct entryInfo_s));
- /*@=sizeoftype@*/
entry->info.tag = HEADER_IMAGE;
}
}
entry->info.offset = -rdl; /* negative offset */
- /*@-assignexpose@*/
entry->data = pe;
- /*@=assignexpose@*/
entry->length = pvlen - sizeof(il) - sizeof(dl);
rdlen = regionSwab(entry+1, ril-1, 0, pe+1, dataStart, dataEnd, entry->info.offset);
if (rdlen < 0)
@@ -1126,12 +999,10 @@ Header headerLoad(/*@kept@*/ void * uh)
}
/* If any duplicate entries were replaced, move new entries down. */
-/*@-boundswrite@*/
if (h->indexUsed < (save - ne)) {
memmove(h->index + h->indexUsed, firstEntry,
(ne * sizeof(*entry)));
}
-/*@=boundswrite@*/
h->indexUsed += ne;
}
}
@@ -1140,22 +1011,14 @@ Header headerLoad(/*@kept@*/ void * uh)
h->flags &= ~HEADERFLAG_SORTED;
headerSort(h);
- /*@-globstate -observertrans @*/
return h;
- /*@=globstate =observertrans @*/
errxit:
- /*@-usereleased@*/
if (h) {
h->index = _free(h->index);
- /*@-refcounttrans@*/
h = _free(h);
- /*@=refcounttrans@*/
}
- /*@=usereleased@*/
- /*@-refcounttrans -globstate@*/
return h;
- /*@=refcounttrans =globstate@*/
}
/** \ingroup header
@@ -1165,19 +1028,14 @@ errxit:
* @param tag region tag
* @return on-disk header (with offsets)
*/
-static /*@null@*/
-Header headerReload(/*@only@*/ Header h, int tag)
- /*@modifies h @*/
+static
+Header headerReload(Header h, int tag)
{
Header nh;
int length;
- /*@-onlytrans@*/
-/*@-boundswrite@*/
void * uh = doHeaderUnload(h, &length);
-/*@=boundswrite@*/
h = headerFree(h);
- /*@=onlytrans@*/
if (uh == NULL)
return NULL;
nh = headerLoad(uh);
@@ -1189,10 +1047,8 @@ Header headerReload(/*@only@*/ Header h, int tag)
uh = _free(uh);
nh->flags |= HEADERFLAG_ALLOCATED;
if (ENTRY_IS_REGION(nh->index)) {
-/*@-boundswrite@*/
if (tag == HEADER_SIGNATURES || tag == HEADER_IMMUTABLE)
nh->index[0].info.tag = tag;
-/*@=boundswrite@*/
}
return nh;
}
@@ -1202,36 +1058,25 @@ Header headerReload(/*@only@*/ Header h, int tag)
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
-static /*@null@*/
+static
Header headerCopyLoad(const void * uh)
- /*@*/
{
int_32 * ei = (int_32 *) uh;
-/*@-boundsread@*/
int_32 il = ntohl(ei[0]); /* index length */
int_32 dl = ntohl(ei[1]); /* data length */
-/*@=boundsread@*/
- /*@-sizeoftype@*/
size_t pvlen = sizeof(il) + sizeof(dl) +
(il * sizeof(struct entryInfo_s)) + dl;
- /*@=sizeoftype@*/
void * nuh = NULL;
Header h = NULL;
/* Sanity checks on header intro. */
- /*@-branchstate@*/
if (!(hdrchkTags(il) || hdrchkData(dl)) && pvlen < headerMaxbytes) {
-/*@-boundsread@*/
nuh = memcpy(xmalloc(pvlen), uh, pvlen);
-/*@=boundsread@*/
if ((h = headerLoad(nuh)) != NULL)
h->flags |= HEADERFLAG_ALLOCATED;
}
- /*@=branchstate@*/
- /*@-branchstate@*/
if (h == NULL)
nuh = _free(nuh);
- /*@=branchstate@*/
return h;
}
@@ -1241,9 +1086,8 @@ Header headerCopyLoad(const void * uh)
* @param magicp read (and verify) 8 bytes of (magic, 0)?
* @return header (or NULL on error)
*/
-static /*@null@*/
+static
Header headerRead(FD_t fd, enum hMagic magicp)
- /*@modifies fd @*/
{
int_32 block[4];
int_32 reserved;
@@ -1260,14 +1104,12 @@ Header headerRead(FD_t fd, enum hMagic magicp)
if (magicp == HEADER_MAGIC_YES)
i += 2;
- /*@-type@*/ /* FIX: cast? */
+ /* FIX: cast? */
if (timedRead(fd, (char *)block, i*sizeof(*block)) != (i * sizeof(*block)))
goto exit;
- /*@=type@*/
i = 0;
-/*@-boundsread@*/
if (magicp == HEADER_MAGIC_YES) {
magic = block[i++];
if (memcmp(&magic, header_magic, sizeof(magic)))
@@ -1277,29 +1119,21 @@ Header headerRead(FD_t fd, enum hMagic magicp)
il = ntohl(block[i]); i++;
dl = ntohl(block[i]); i++;
-/*@=boundsread@*/
- /*@-sizeoftype@*/
len = sizeof(il) + sizeof(dl) + (il * sizeof(struct entryInfo_s)) + dl;
- /*@=sizeoftype@*/
/* Sanity checks on header intro. */
if (hdrchkTags(il) || hdrchkData(dl) || len > headerMaxbytes)
goto exit;
-/*@-boundswrite@*/
ei = xmalloc(len);
ei[0] = htonl(il);
ei[1] = htonl(dl);
len -= sizeof(il) + sizeof(dl);
-/*@=boundswrite@*/
-/*@-boundsread@*/
- /*@-type@*/ /* FIX: cast? */
+ /* FIX: cast? */
if (timedRead(fd, (char *)&ei[2], len) != len)
goto exit;
- /*@=type@*/
-/*@=boundsread@*/
h = headerLoad(ei);
@@ -1310,9 +1144,8 @@ exit:
h->flags |= HEADERFLAG_ALLOCATED;
} else if (ei)
ei = _free(ei);
- /*@-mustmod@*/ /* FIX: timedRead macro obscures annotation */
+ /* FIX: timedRead macro obscures annotation */
return h;
- /*@-mustmod@*/
}
/** \ingroup header
@@ -1323,9 +1156,7 @@ exit:
* @return 0 on success, 1 on error
*/
static
-int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
- /*@globals fileSystem @*/
- /*@modifies fd, h, fileSystem @*/
+int headerWrite(FD_t fd, Header h, enum hMagic magicp)
{
ssize_t nb;
int length;
@@ -1333,18 +1164,12 @@ int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
if (h == NULL)
return 1;
-/*@-boundswrite@*/
uh = doHeaderUnload(h, &length);
-/*@=boundswrite@*/
if (uh == NULL)
return 1;
switch (magicp) {
case HEADER_MAGIC_YES:
-/*@-boundsread@*/
- /*@-sizeoftype@*/
nb = Fwrite(header_magic, sizeof(char), sizeof(header_magic), fd);
- /*@=sizeoftype@*/
-/*@=boundsread@*/
if (nb != sizeof(header_magic))
goto exit;
break;
@@ -1352,9 +1177,7 @@ int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
break;
}
- /*@-sizeoftype@*/
nb = Fwrite(uh, sizeof(char), length, fd);
- /*@=sizeoftype@*/
exit:
uh = _free(uh);
@@ -1368,12 +1191,11 @@ exit:
* @return 1 on success, 0 on failure
*/
static
-int headerIsEntry(/*@null@*/Header h, int_32 tag)
- /*@*/
+int headerIsEntry(Header h, int_32 tag)
{
- /*@-mods@*/ /*@ FIX: h modified by sort. */
+ /* FIX: h modified by sort. */
return (findEntry(h, tag, RPM_NULL_TYPE) ? 1 : 0);
- /*@=mods@*/
+
}
/** \ingroup header
@@ -1387,12 +1209,10 @@ int headerIsEntry(/*@null@*/Header h, int_32 tag)
* @return 1 on success, otherwise error.
*/
static int copyEntry(const indexEntry entry,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c,
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c,
int minMem)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
{
int_32 count = entry->info.count;
int rc = 1; /* XXX 1 on success. */
@@ -1408,16 +1228,11 @@ static int copyEntry(const indexEntry entry,
*/
if (ENTRY_IS_REGION(entry)) {
int_32 * ei = ((int_32 *)entry->data) - 2;
- /*@-castexpose@*/
entryInfo pe = (entryInfo) (ei + 2);
- /*@=castexpose@*/
-/*@-boundsread@*/
unsigned char * dataStart = (unsigned char *) (pe + ntohl(ei[0]));
-/*@=boundsread@*/
int_32 rdl = -entry->info.offset; /* negative offset */
int_32 ril = rdl/sizeof(*pe);
- /*@-sizeoftype@*/
rdl = entry->rdlen;
count = 2 * sizeof(*ei) + (ril * sizeof(*pe)) + rdl;
if (entry->info.tag == HEADER_IMAGE) {
@@ -1428,19 +1243,14 @@ static int copyEntry(const indexEntry entry,
rdl += REGION_TAG_COUNT;
}
-/*@-bounds@*/
*p = xmalloc(count);
ei = (int_32 *) *p;
ei[0] = htonl(ril);
ei[1] = htonl(rdl);
- /*@-castexpose@*/
pe = (entryInfo) memcpy(ei + 2, pe, (ril * sizeof(*pe)));
- /*@=castexpose@*/
dataStart = (unsigned char *) memcpy(pe + ril, dataStart, rdl);
- /*@=sizeoftype@*/
-/*@=bounds@*/
rc = regionSwab(NULL, ril, 0, pe, dataStart, NULL, 0);
/* XXX 1 on success. */
@@ -1457,18 +1267,13 @@ static int copyEntry(const indexEntry entry,
*p = entry->data;
break;
}
- /*@fallthrough@*/
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
{ const char ** ptrEntry;
- /*@-sizeoftype@*/
int tableSize = count * sizeof(char *);
- /*@=sizeoftype@*/
char * t;
int i;
-/*@-bounds@*/
- /*@-mods@*/
if (minMem) {
*p = xmalloc(tableSize);
ptrEntry = (const char **) *p;
@@ -1480,12 +1285,8 @@ static int copyEntry(const indexEntry entry,
t += tableSize;
memcpy(t, entry->data, entry->length);
}
- /*@=mods@*/
-/*@=bounds@*/
for (i = 0; i < count; i++) {
-/*@-boundswrite@*/
*ptrEntry++ = t;
-/*@=boundswrite@*/
t = strchr(t, 0);
t++;
}
@@ -1519,7 +1320,6 @@ static int copyEntry(const indexEntry entry,
* @return 1 on match, 0 on no match
*/
static int headerMatchLocale(const char *td, const char *l, const char *le)
- /*@*/
{
const char *fe;
@@ -1590,9 +1390,8 @@ static int headerMatchLocale(const char *td, const char *l, const char *le)
* @param entry i18n string data
* @return matching i18n string (or 1st string if no match)
*/
-/*@dependent@*/ /*@exposed@*/ static char *
+static char *
headerFindI18NString(Header h, indexEntry entry)
- /*@*/
{
const char *lang, *l, *le;
indexEntry table;
@@ -1604,12 +1403,9 @@ headerFindI18NString(Header h, indexEntry entry)
(lang = getenv("LANG")) == NULL)
return entry->data;
- /*@-mods@*/
if ((table = findEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE)) == NULL)
return entry->data;
- /*@=mods@*/
-/*@-boundsread@*/
for (l = lang; *l != '\0'; l = le) {
const char *td;
char *ed;
@@ -1632,7 +1428,6 @@ headerFindI18NString(Header h, indexEntry entry)
}
}
-/*@=boundsread@*/
return entry->data;
}
@@ -1648,20 +1443,17 @@ headerFindI18NString(Header h, indexEntry entry)
* @return 1 on success, 0 on not found
*/
static int intGetEntry(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTAG_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c,
+ hTAG_t type,
+ hPTR_t * p,
+ hCNT_t c,
int minMem)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
{
indexEntry entry;
int rc;
/* First find the tag */
- /*@-mods@*/ /*@ FIX: h modified by sort. */
+ /* FIX: h modified by sort. */
entry = findEntry(h, tag, RPM_NULL_TYPE);
- /*@mods@*/
if (entry == NULL) {
if (type) type = 0;
if (p) *p = NULL;
@@ -1674,9 +1466,7 @@ static int intGetEntry(Header h, int_32 tag,
rc = 1;
if (type) *type = RPM_STRING_TYPE;
if (c) *c = 1;
- /*@-dependenttrans@*/
if (p) *p = headerFindI18NString(h, entry);
- /*@=dependenttrans@*/
break;
default:
rc = copyEntry(entry, type, p, c, minMem);
@@ -1694,18 +1484,15 @@ static int intGetEntry(Header h, int_32 tag,
* @param type type of data (or -1 to force free)
* @return NULL always
*/
-static /*@null@*/ void * headerFreeTag(/*@unused@*/ Header h,
- /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
- /*@modifies data @*/
+static void * headerFreeTag(Header h,
+ const void * data, rpmTagType type)
{
if (data) {
- /*@-branchstate@*/
if (type == -1 ||
type == RPM_STRING_ARRAY_TYPE ||
type == RPM_I18NSTRING_TYPE ||
type == RPM_BIN_TYPE)
data = _free(data);
- /*@=branchstate@*/
}
return NULL;
}
@@ -1725,11 +1512,9 @@ static /*@null@*/ void * headerFreeTag(/*@unused@*/ Header h,
*/
static
int headerGetEntry(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void ** p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
+ hTYP_t type,
+ void ** p,
+ hCNT_t c)
{
return intGetEntry(h, tag, type, (hPTR_t *)p, c, 0);
}
@@ -1748,11 +1533,9 @@ int headerGetEntry(Header h, int_32 tag,
*/
static
int headerGetEntryMinMemory(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c)
{
return intGetEntry(h, tag, type, p, c, 1);
}
@@ -1766,9 +1549,8 @@ int headerGetRawEntry(Header h, int_32 tag, int_32 * type, hPTR_t * p,
if (p == NULL) return headerIsEntry(h, tag);
/* First find the tag */
- /*@-mods@*/ /*@ FIX: h modified by sort. */
+ /* FIX: h modified by sort. */
entry = findEntry(h, tag, RPM_NULL_TYPE);
- /*@=mods@*/
if (!entry) {
if (p) *p = NULL;
if (c) *c = 0;
@@ -1783,9 +1565,8 @@ int headerGetRawEntry(Header h, int_32 tag, int_32 * type, hPTR_t * p,
/**
*/
-static void copyData(int_32 type, /*@out@*/ void * dstPtr, const void * srcPtr,
+static void copyData(int_32 type, void * dstPtr, const void * srcPtr,
int_32 cnt, int dataLength)
- /*@modifies *dstPtr @*/
{
switch (type) {
case RPM_STRING_ARRAY_TYPE:
@@ -1793,7 +1574,6 @@ static void copyData(int_32 type, /*@out@*/ void * dstPtr, const void * srcPtr,
{ const char ** av = (const char **) srcPtr;
char * t = dstPtr;
-/*@-bounds@*/
while (cnt-- > 0 && dataLength > 0) {
const char * s;
if ((s = *av++) == NULL)
@@ -1802,13 +1582,10 @@ static void copyData(int_32 type, /*@out@*/ void * dstPtr, const void * srcPtr,
*t++ = *s++;
} while (s[-1] && --dataLength > 0);
}
-/*@=bounds@*/
} break;
default:
-/*@-boundswrite@*/
memmove(dstPtr, srcPtr, dataLength);
-/*@=boundswrite@*/
break;
}
}
@@ -1821,22 +1598,17 @@ static void copyData(int_32 type, /*@out@*/ void * dstPtr, const void * srcPtr,
* @retval lengthPtr no. bytes in returned data
* @return (malloc'ed) copy of entry data, NULL on error
*/
-/*@null@*/
static void *
-grabData(int_32 type, hPTR_t p, int_32 c, /*@out@*/ int * lengthPtr)
- /*@modifies *lengthPtr @*/
- /*@requires maxSet(lengthPtr) >= 0 @*/
+grabData(int_32 type, hPTR_t p, int_32 c, int * lengthPtr)
{
void * data = NULL;
int length;
length = dataLength(type, p, c, 0, NULL);
-/*@-branchstate@*/
if (length > 0) {
data = xmalloc(length);
copyData(type, data, p, c, length);
}
-/*@=branchstate@*/
if (lengthPtr)
*lengthPtr = length;
@@ -1859,7 +1631,6 @@ grabData(int_32 type, hPTR_t p, int_32 c, /*@out@*/ int * lengthPtr)
*/
static
int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/
{
indexEntry entry;
void * data;
@@ -1875,9 +1646,7 @@ int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
return 0;
length = 0;
-/*@-boundswrite@*/
data = grabData(type, p, c, &length);
-/*@=boundswrite@*/
if (data == NULL || length <= 0)
return 0;
@@ -1896,10 +1665,8 @@ int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
entry->data = data;
entry->length = length;
-/*@-boundsread@*/
if (h->indexUsed > 0 && tag < h->index[h->indexUsed-1].info.tag)
h->flags &= ~HEADERFLAG_SORTED;
-/*@=boundsread@*/
h->indexUsed++;
return 1;
@@ -1922,7 +1689,6 @@ int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
static
int headerAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
indexEntry entry;
int length;
@@ -1943,9 +1709,7 @@ int headerAppendEntry(Header h, int_32 tag, int_32 type,
if (ENTRY_IN_REGION(entry)) {
char * t = xmalloc(entry->length + length);
-/*@-bounds@*/
memcpy(t, entry->data, entry->length);
-/*@=bounds@*/
entry->data = t;
entry->info.offset = 0;
} else
@@ -1973,7 +1737,6 @@ int headerAppendEntry(Header h, int_32 tag, int_32 type,
static
int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
return (findEntry(h, tag, type)
? headerAppendEntry(h, tag, type, p, c)
@@ -2003,7 +1766,6 @@ int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
static
int headerAddI18NString(Header h, int_32 tag, const char * string,
const char * lang)
- /*@modifies h @*/
{
indexEntry table, entry;
const char ** strArray;
@@ -2022,13 +1784,9 @@ int headerAddI18NString(Header h, int_32 tag, const char * string,
const char * charArray[2];
int count = 0;
if (!lang || (lang[0] == 'C' && lang[1] == '\0')) {
- /*@-observertrans -readonlytrans@*/
charArray[count++] = "C";
- /*@=observertrans =readonlytrans@*/
} else {
- /*@-observertrans -readonlytrans@*/
charArray[count++] = "C";
- /*@=observertrans =readonlytrans@*/
charArray[count++] = lang;
}
if (!headerAddEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE,
@@ -2039,9 +1797,7 @@ int headerAddI18NString(Header h, int_32 tag, const char * string,
if (!table)
return 0;
- /*@-branchstate@*/
if (!lang) lang = "C";
- /*@=branchstate@*/
{ const char * l = table->data;
for (langNum = 0; langNum < table->info.count; langNum++) {
@@ -2112,12 +1868,10 @@ int headerAddI18NString(Header h, int_32 tag, const char * string,
/* Copy values into new storage */
memcpy(t, b, bn);
t += bn;
-/*@-mayaliasunique@*/
memcpy(t, string, sn);
t += sn;
memcpy(t, e, en);
t += en;
-/*@=mayaliasunique@*/
/* Replace i18N string array */
entry->length -= strlen(be) + 1;
@@ -2127,9 +1881,7 @@ int headerAddI18NString(Header h, int_32 tag, const char * string,
entry->info.offset = 0;
} else
entry->data = _free(entry->data);
- /*@-dependenttrans@*/
entry->data = buf;
- /*@=dependenttrans@*/
}
return 0;
@@ -2148,7 +1900,6 @@ int headerAddI18NString(Header h, int_32 tag, const char * string,
static
int headerModifyEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
indexEntry entry;
void * oldData;
@@ -2178,19 +1929,17 @@ int headerModifyEntry(Header h, int_32 tag, int_32 type,
entry->data = data;
entry->length = length;
- /*@-branchstate@*/
if (ENTRY_IN_REGION(entry)) {
entry->info.offset = 0;
} else
oldData = _free(oldData);
- /*@=branchstate@*/
return 1;
}
/**
*/
-static char escapedChar(const char ch) /*@*/
+static char escapedChar(const char ch)
{
switch (ch) {
case 'a': return '\a';
@@ -2210,9 +1959,8 @@ static char escapedChar(const char ch) /*@*/
* @param num number of elements
* @return NULL always
*/
-static /*@null@*/ sprintfToken
-freeFormat( /*@only@*/ /*@null@*/ sprintfToken format, int num)
- /*@modifies *format @*/
+static sprintfToken
+freeFormat( sprintfToken format, int num)
{
int i;
@@ -2221,27 +1969,23 @@ freeFormat( /*@only@*/ /*@null@*/ sprintfToken format, int num)
for (i = 0; i < num; i++) {
switch (format[i].type) {
case PTOK_ARRAY:
-/*@-boundswrite@*/
format[i].u.array.format =
freeFormat(format[i].u.array.format,
format[i].u.array.numTokens);
-/*@=boundswrite@*/
- /*@switchbreak@*/ break;
+ break;
case PTOK_COND:
-/*@-boundswrite@*/
format[i].u.cond.ifFormat =
freeFormat(format[i].u.cond.ifFormat,
format[i].u.cond.numIfTokens);
format[i].u.cond.elseFormat =
freeFormat(format[i].u.cond.elseFormat,
format[i].u.cond.numElseTokens);
-/*@=boundswrite@*/
- /*@switchbreak@*/ break;
+ break;
case PTOK_NONE:
case PTOK_TAG:
case PTOK_STRING:
default:
- /*@switchbreak@*/ break;
+ break;
}
}
format = _free(format);
@@ -2252,9 +1996,7 @@ freeFormat( /*@only@*/ /*@null@*/ sprintfToken format, int num)
* Header tag iterator data structure.
*/
struct headerIterator_s {
-/*@unused@*/
Header h; /*!< Header being iterated. */
-/*@unused@*/
int next_index; /*!< Next tag index. */
};
@@ -2263,9 +2005,8 @@ struct headerIterator_s {
* @param hi header tag iterator
* @return NULL always
*/
-static /*@null@*/
-HeaderIterator headerFreeIterator(/*@only@*/ HeaderIterator hi)
- /*@modifies hi @*/
+static
+HeaderIterator headerFreeIterator(HeaderIterator hi)
{
if (hi != NULL) {
hi->h = headerFree(hi->h);
@@ -2281,7 +2022,6 @@ HeaderIterator headerFreeIterator(/*@only@*/ HeaderIterator hi)
*/
static
HeaderIterator headerInitIterator(Header h)
- /*@modifies h */
{
HeaderIterator hi = xmalloc(sizeof(*hi));
@@ -2303,13 +2043,10 @@ HeaderIterator headerInitIterator(Header h)
*/
static
int headerNextIterator(HeaderIterator hi,
- /*@null@*/ /*@out@*/ hTAG_t tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies hi, *tag, *type, *p, *c @*/
- /*@requires maxSet(tag) >= 0 /\ maxSet(type) >= 0
- /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
+ hTAG_t tag,
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c)
{
Header h = hi->h;
int slot = hi->next_index;
@@ -2325,9 +2062,8 @@ int headerNextIterator(HeaderIterator hi,
if (entry == NULL || slot >= h->indexUsed)
return 0;
- /*@-noeffect@*/ /* LCL: no clue */
+ /* LCL: no clue */
hi->next_index++;
- /*@=noeffect@*/
if (tag)
*tag = entry->info.tag;
@@ -2343,16 +2079,14 @@ int headerNextIterator(HeaderIterator hi,
* @param h header
* @return new header instance
*/
-static /*@null@*/
+static
Header headerCopy(Header h)
- /*@modifies h @*/
{
Header nh = headerNew();
HeaderIterator hi;
int_32 tag, type, count;
hPTR_t ptr;
- /*@-branchstate@*/
for (hi = headerInitIterator(h);
headerNextIterator(hi, &tag, &type, &ptr, &count);
ptr = headerFreeData((void *)ptr, type))
@@ -2360,7 +2094,6 @@ Header headerCopy(Header h)
if (ptr) (void) headerAddEntry(nh, tag, type, ptr, count);
}
hi = headerFreeIterator(hi);
- /*@=branchstate@*/
return headerReload(nh, HEADER_IMAGE);
}
@@ -2370,17 +2103,12 @@ Header headerCopy(Header h)
typedef struct headerSprintfArgs_s {
Header h;
char * fmt;
-/*@temp@*/
headerTagTableEntry tags;
-/*@temp@*/
headerSprintfExtension exts;
-/*@observer@*/ /*@null@*/
const char * errmsg;
rpmec ec;
sprintfToken format;
-/*@relnull@*/
HeaderIterator hi;
-/*@owned@*/
char * val;
size_t vallen;
size_t alloced;
@@ -2393,8 +2121,7 @@ typedef struct headerSprintfArgs_s {
* @param hsa headerSprintf args
* @return headerSprintf args
*/
-static headerSprintfArgs hsaInit(/*@returned@*/ headerSprintfArgs hsa)
- /*@modifies hsa */
+static headerSprintfArgs hsaInit(headerSprintfArgs hsa)
{
sprintfTag tag =
(hsa->format->type == PTOK_TAG
@@ -2408,9 +2135,7 @@ static headerSprintfArgs hsaInit(/*@returned@*/ headerSprintfArgs hsa)
if (tag != NULL && tag->tag == -2)
hsa->hi = headerInitIterator(hsa->h);
}
-/*@-nullret@*/
return hsa;
-/*@=nullret@*/
}
/**
@@ -2418,9 +2143,7 @@ static headerSprintfArgs hsaInit(/*@returned@*/ headerSprintfArgs hsa)
* @param hsa headerSprintf args
* @return next sprintfToken (or NULL)
*/
-/*@null@*/
-static sprintfToken hsaNext(/*@returned@*/ headerSprintfArgs hsa)
- /*@modifies hsa */
+static sprintfToken hsaNext(headerSprintfArgs hsa)
{
sprintfToken fmt = NULL;
sprintfTag tag =
@@ -2439,17 +2162,13 @@ static sprintfToken hsaNext(/*@returned@*/ headerSprintfArgs hsa)
int_32 type;
int_32 count;
-/*@-boundswrite@*/
if (!headerNextIterator(hsa->hi, &tagno, &type, NULL, &count))
fmt = NULL;
tag->tag = tagno;
-/*@=boundswrite@*/
}
}
-/*@-dependenttrans -onlytrans@*/
return fmt;
-/*@=dependenttrans =onlytrans@*/
}
/**
@@ -2457,16 +2176,13 @@ static sprintfToken hsaNext(/*@returned@*/ headerSprintfArgs hsa)
* @param hsa headerSprintf args
* @return headerSprintf args
*/
-static headerSprintfArgs hsaFini(/*@returned@*/ headerSprintfArgs hsa)
- /*@modifies hsa */
+static headerSprintfArgs hsaFini(headerSprintfArgs hsa)
{
if (hsa != NULL) {
hsa->hi = headerFreeIterator(hsa->hi);
hsa->i = 0;
}
-/*@-nullret@*/
return hsa;
-/*@=nullret@*/
}
/**
@@ -2475,9 +2191,7 @@ static headerSprintfArgs hsaFini(/*@returned@*/ headerSprintfArgs hsa)
* @param need no. of bytes to reserve
* @return pointer to reserved space
*/
-/*@dependent@*/ /*@exposed@*/
static char * hsaReserve(headerSprintfArgs hsa, size_t need)
- /*@modifies hsa */
{
if ((hsa->vallen + need) >= hsa->alloced) {
if (hsa->alloced <= need)
@@ -2495,9 +2209,7 @@ static char * hsaReserve(headerSprintfArgs hsa, size_t need)
* @param val tag value to find
* @return tag name, NULL on not found
*/
-/*@observer@*/ /*@null@*/
static const char * myTagName(headerTagTableEntry tbl, int val)
- /*@*/
{
static char name[128];
const char * s;
@@ -2526,7 +2238,6 @@ static const char * myTagName(headerTagTableEntry tbl, int val)
* @return tag value, 0 on not found
*/
static int myTagValue(headerTagTableEntry tbl, const char * name)
- /*@*/
{
for (; tbl->name != NULL; tbl++) {
if (!xstrcasecmp(tbl->name, name))
@@ -2542,7 +2253,6 @@ static int myTagValue(headerTagTableEntry tbl, const char * name)
* @return 0 on success, 1 on not found
*/
static int findTag(headerSprintfArgs hsa, sprintfToken token, const char * name)
- /*@modifies token @*/
{
headerSprintfExtension ext;
sprintfTag stag = (token->type == PTOK_COND
@@ -2558,15 +2268,11 @@ static int findTag(headerSprintfArgs hsa, sprintfToken token, const char * name)
goto bingo;
}
-/*@-branchstate@*/
if (strncmp("RPMTAG_", name, sizeof("RPMTAG_")-1)) {
-/*@-boundswrite@*/
char * t = alloca(strlen(name) + sizeof("RPMTAG_"));
(void) stpcpy( stpcpy(t, "RPMTAG_"), name);
name = t;
-/*@=boundswrite@*/
}
-/*@=branchstate@*/
/* Search extensions for specific tag override. */
for (ext = hsa->exts; ext != NULL && ext->type != HEADER_EXT_LAST;
@@ -2613,9 +2319,7 @@ bingo:
* @return 0 on success
*/
static int parseExpression(headerSprintfArgs hsa, sprintfToken token,
- char * str, /*@out@*/char ** endPtr)
- /*@modifies hsa, str, token, *endPtr @*/
- /*@requires maxSet(endPtr) >= 0 @*/;
+ char * str,char ** endPtr);
/**
* @param hsa headerSprintf args
@@ -2626,12 +2330,9 @@ static int parseExpression(headerSprintfArgs hsa, sprintfToken token,
* @param state
* @return 0 on success
*/
-static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
- /*@out@*/sprintfToken * formatPtr, /*@out@*/int * numTokensPtr,
- /*@null@*/ /*@out@*/ char ** endPtr, int state)
- /*@modifies hsa, str, *formatPtr, *numTokensPtr, *endPtr @*/
- /*@requires maxSet(formatPtr) >= 0 /\ maxSet(numTokensPtr) >= 0
- /\ maxSet(endPtr) >= 0 @*/
+static int parseFormat(headerSprintfArgs hsa, char * str,
+ sprintfToken * formatPtr,int * numTokensPtr,
+ char ** endPtr, int state)
{
char * chptr, * start, * next, * dst;
sprintfToken format;
@@ -2650,7 +2351,7 @@ static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
format = xcalloc(numTokens, sizeof(*format));
if (endPtr) *endPtr = NULL;
- /*@-infloops@*/ /* LCL: can't detect done termination */
+ /* LCL: can't detect done termination */
dst = start = str;
numTokens = 0;
token = NULL;
@@ -2663,41 +2364,31 @@ static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
if (token == NULL || token->type != PTOK_STRING) {
token = format + numTokens++;
token->type = PTOK_STRING;
- /*@-temptrans -assignexpose@*/
dst = token->u.string.string = start;
- /*@=temptrans =assignexpose@*/
}
start++;
-/*@-boundswrite@*/
*dst++ = *start++;
-/*@=boundswrite@*/
- /*@switchbreak@*/ break;
+ break;
}
token = format + numTokens++;
-/*@-boundswrite@*/
*dst++ = '\0';
-/*@=boundswrite@*/
start++;
if (*start == '|') {
char * newEnd;
start++;
-/*@-boundswrite@*/
if (parseExpression(hsa, token, start, &newEnd))
{
format = freeFormat(format, numTokens);
return 1;
}
-/*@=boundswrite@*/
start = newEnd;
- /*@switchbreak@*/ break;
+ break;
}
- /*@-assignexpose@*/
token->u.tag.format = start;
- /*@=assignexpose@*/
token->u.tag.pad = 0;
token->u.tag.justOne = 0;
token->u.tag.arrayCount = 0;
@@ -2710,9 +2401,7 @@ static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
return 1;
}
-/*@-boundswrite@*/
*chptr++ = '\0';
-/*@=boundswrite@*/
while (start < chptr) {
if (xisdigit(*start)) {
@@ -2739,25 +2428,19 @@ static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
format = freeFormat(format, numTokens);
return 1;
}
-/*@-boundswrite@*/
*next++ = '\0';
-/*@=boundswrite@*/
chptr = start;
while (*chptr && *chptr != ':') chptr++;
if (*chptr != '\0') {
-/*@-boundswrite@*/
*chptr++ = '\0';
-/*@=boundswrite@*/
if (!*chptr) {
hsa->errmsg = _("empty tag format");
format = freeFormat(format, numTokens);
return 1;
}
- /*@-assignexpose@*/
token->u.tag.type = chptr;
- /*@=assignexpose@*/
} else {
token->u.tag.type = NULL;
}
@@ -2778,16 +2461,13 @@ static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
}
start = next;
- /*@switchbreak@*/ break;
+ break;
case '[':
-/*@-boundswrite@*/
*dst++ = '\0';
*start++ = '\0';
-/*@=boundswrite@*/
token = format + numTokens++;
-/*@-boundswrite@*/
if (parseFormat(hsa, start,
&token->u.array.format,
&token->u.array.numTokens,
@@ -2796,7 +2476,6 @@ static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
format = freeFormat(format, numTokens);
return 1;
}
-/*@=boundswrite@*/
if (!start) {
hsa->errmsg = _("] expected at end of array");
@@ -2808,7 +2487,7 @@ static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
token->type = PTOK_ARRAY;
- /*@switchbreak@*/ break;
+ break;
case ']':
if (state != PARSER_IN_ARRAY) {
@@ -2816,12 +2495,10 @@ static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
format = freeFormat(format, numTokens);
return 1;
}
-/*@-boundswrite@*/
*start++ = '\0';
-/*@=boundswrite@*/
if (endPtr) *endPtr = start;
done = 1;
- /*@switchbreak@*/ break;
+ break;
case '}':
if (state != PARSER_IN_EXPR) {
@@ -2829,41 +2506,32 @@ static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
format = freeFormat(format, numTokens);
return 1;
}
-/*@-boundswrite@*/
*start++ = '\0';
-/*@=boundswrite@*/
if (endPtr) *endPtr = start;
done = 1;
- /*@switchbreak@*/ break;
+ break;
default:
if (token == NULL || token->type != PTOK_STRING) {
token = format + numTokens++;
token->type = PTOK_STRING;
- /*@-temptrans -assignexpose@*/
dst = token->u.string.string = start;
- /*@=temptrans =assignexpose@*/
}
-/*@-boundswrite@*/
if (*start == '\\') {
start++;
*dst++ = escapedChar(*start++);
} else {
*dst++ = *start++;
}
-/*@=boundswrite@*/
- /*@switchbreak@*/ break;
+ break;
}
if (done)
break;
}
- /*@=infloops@*/
-/*@-boundswrite@*/
if (dst != NULL)
*dst = '\0';
-/*@=boundswrite@*/
for (i = 0; i < numTokens; i++) {
token = format + i;
@@ -2877,9 +2545,8 @@ static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
return 0;
}
-/*@-boundswrite@*/
static int parseExpression(headerSprintfArgs hsa, sprintfToken token,
- char * str, /*@out@*/ char ** endPtr)
+ char * str, char ** endPtr)
{
char * chptr;
char * end;
@@ -2975,7 +2642,6 @@ static int parseExpression(headerSprintfArgs hsa, sprintfToken token,
return 0;
}
-/*@=boundswrite@*/
/**
* Call a header extension only once, saving results.
@@ -2988,13 +2654,10 @@ static int parseExpression(headerSprintfArgs hsa, sprintfToken token,
* @return 0 on success, 1 on failure
*/
static int getExtension(headerSprintfArgs hsa, headerTagTagFunction fn,
- /*@out@*/ hTYP_t typeptr,
- /*@out@*/ hPTR_t * data,
- /*@out@*/ hCNT_t countptr,
+ hTYP_t typeptr,
+ hPTR_t * data,
+ hCNT_t countptr,
rpmec ec)
- /*@modifies *typeptr, *data, *countptr, ec @*/
- /*@requires maxSet(typeptr) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(countptr) >= 0 @*/
{
if (!ec->avail) {
if (fn(hsa->h, &ec->type, &ec->data, &ec->count, &ec->freeit))
@@ -3015,9 +2678,7 @@ static int getExtension(headerSprintfArgs hsa, headerTagTagFunction fn,
* @param element
* @return end of formatted string (NULL on error)
*/
-/*@observer@*/ /*@null@*/
static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
- /*@modifies hsa @*/
{
char * val = NULL;
size_t need = 0;
@@ -3032,30 +2693,24 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
memset(buf, 0, sizeof(buf));
if (tag->ext) {
-/*@-boundswrite -branchstate @*/
if (getExtension(hsa, tag->ext, &type, &data, &count, hsa->ec + tag->extNum))
{
count = 1;
type = RPM_STRING_TYPE;
data = "(none)";
}
-/*@=boundswrite =branchstate @*/
} else {
-/*@-boundswrite -branchstate @*/
if (!headerGetEntry(hsa->h, tag->tag, &type, (void **)&data, &count)) {
count = 1;
type = RPM_STRING_TYPE;
data = "(none)";
}
-/*@=boundswrite =branchstate @*/
/* XXX this test is unnecessary, array sizes are checked */
switch (type) {
default:
if (element >= count) {
- /*@-modobserver -observertrans@*/
data = headerFreeData(data, type);
- /*@=modobserver =observertrans@*/
hsa->errmsg = _("(index out of range)");
return NULL;
@@ -3069,10 +2724,8 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
}
if (tag->arrayCount) {
- /*@-branchstate -observertrans -modobserver@*/
if (datafree)
data = headerFreeData(data, type);
- /*@=branchstate =observertrans =modobserver@*/
countBuf = count;
data = &countBuf;
@@ -3080,11 +2733,8 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
type = RPM_INT32_TYPE;
}
-/*@-boundswrite@*/
(void) stpcpy( stpcpy(buf, "%"), tag->format);
-/*@=boundswrite@*/
- /*@-branchstate@*/
if (data)
switch (type) {
case RPM_STRING_ARRAY_TYPE:
@@ -3099,9 +2749,7 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
need = strlen(strarray[element]) + tag->pad + 20;
val = xmalloc(need+1);
strcat(buf, "s");
- /*@-formatconst@*/
sprintf(val, buf, strarray[element]);
- /*@=formatconst@*/
}
break;
@@ -3116,9 +2764,7 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
need = strlen(data) + tag->pad + 20;
val = xmalloc(need+1);
strcat(buf, "s");
- /*@-formatconst@*/
sprintf(val, buf, data);
- /*@=formatconst@*/
}
break;
@@ -3130,14 +2776,14 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
intVal = *(((int_8 *) data) + element);
- /*@innerbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
intVal = *(((uint_16 *) data) + element);
- /*@innerbreak@*/ break;
+ break;
default: /* keep -Wall quiet */
case RPM_INT32_TYPE:
intVal = *(((int_32 *) data) + element);
- /*@innerbreak@*/ break;
+ break;
}
if (tag->fmt)
@@ -3149,9 +2795,7 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
need = 10 + tag->pad + 20;
val = xmalloc(need+1);
strcat(buf, "d");
- /*@-formatconst@*/
sprintf(val, buf, intVal);
- /*@=formatconst@*/
}
break;
@@ -3173,23 +2817,16 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
val = xstrdup("(unknown type)");
break;
}
- /*@=branchstate@*/
- /*@-branchstate -observertrans -modobserver@*/
if (datafree)
data = headerFreeData(data, type);
- /*@=branchstate =observertrans =modobserver@*/
- /*@-branchstate@*/
if (val && need > 0) {
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, val);
-/*@=boundswrite@*/
hsa->vallen += (te - t);
val = _free(val);
}
- /*@=branchstate@*/
return (hsa->val + hsa->vallen);
}
@@ -3200,10 +2837,8 @@ static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
* @param element
* @return end of formatted string (NULL on error)
*/
-/*@observer@*/
static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
int element)
- /*@modifies hsa @*/
{
char * t, * te;
int i, j;
@@ -3224,9 +2859,7 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
need = token->u.string.len;
if (need == 0) break;
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, token->u.string.string);
-/*@=boundswrite@*/
hsa->vallen += (te - t);
break;
@@ -3268,16 +2901,12 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
spft->u.tag.justOne) continue;
if (spft->u.tag.ext) {
-/*@-boundswrite@*/
if (getExtension(hsa, spft->u.tag.ext, &type, NULL, &count,
hsa->ec + spft->u.tag.extNum))
continue;
-/*@=boundswrite@*/
} else {
-/*@-boundswrite@*/
if (!headerGetEntry(hsa->h, spft->u.tag.tag, &type, NULL, &count))
continue;
-/*@=boundswrite@*/
}
if (type == RPM_BIN_TYPE)
@@ -3289,10 +2918,10 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
hsa->errmsg =
_("array iterator used with different sized arrays");
return NULL;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPM_BIN_TYPE:
case RPM_STRING_TYPE:
- /*@switchbreak@*/ break;
+ break;
}
if (count > numElements)
numElements = count;
@@ -3301,9 +2930,7 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
if (numElements == -1) {
need = sizeof("(none)") - 1;
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, "(none)");
-/*@=boundswrite@*/
hsa->vallen += (te - t);
} else {
int isxml;
@@ -3322,12 +2949,10 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
if (tagN != NULL)
need += strlen(tagN);
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, " <rpmTag name=\"");
if (tagN != NULL)
te = stpcpy(te, tagN);
te = stpcpy(te, "\">\n");
-/*@=boundswrite@*/
hsa->vallen += (te - t);
}
@@ -3344,9 +2969,7 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
if (isxml) {
need = sizeof(" </rpmTag>\n") - 1;
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, " </rpmTag>\n");
-/*@=boundswrite@*/
hsa->vallen += (te - t);
}
@@ -3362,9 +2985,8 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
* @param exts headerSprintf extensions
* @return new extension cache
*/
-static /*@only@*/ rpmec
+static rpmec
rpmecNew(const headerSprintfExtension exts)
- /*@*/
{
headerSprintfExtension ext;
rpmec ec;
@@ -3386,9 +3008,8 @@ rpmecNew(const headerSprintfExtension exts)
* @param ec extension cache
* @return NULL always
*/
-static /*@null@*/ rpmec
-rpmecFree(const headerSprintfExtension exts, /*@only@*/ rpmec ec)
- /*@modifies ec @*/
+static rpmec
+rpmecFree(const headerSprintfExtension exts, rpmec ec)
{
headerSprintfExtension ext;
int i = 0;
@@ -3396,9 +3017,7 @@ rpmecFree(const headerSprintfExtension exts, /*@only@*/ rpmec ec)
for (ext = exts; ext != NULL && ext->type != HEADER_EXT_LAST;
ext = (ext->type == HEADER_EXT_MORE ? ext->u.more : ext+1))
{
-/*@-boundswrite@*/
if (ec[i].freeit) ec[i].data = _free(ec[i].data);
-/*@=boundswrite@*/
i++;
}
@@ -3417,13 +3036,11 @@ rpmecFree(const headerSprintfExtension exts, /*@only@*/ rpmec ec)
* @retval *errmsg error message (if any)
* @return formatted output string (malloc'ed)
*/
-static /*@only@*/ /*@null@*/
+static
char * headerSprintf(Header h, const char * fmt,
const struct headerTagTableEntry_s * tbltags,
const struct headerSprintfExtension_s * extensions,
- /*@null@*/ /*@out@*/ errmsg_t * errmsg)
- /*@modifies h, *errmsg @*/
- /*@requires maxSet(errmsg) >= 0 @*/
+ errmsg_t * errmsg)
{
headerSprintfArgs hsa = memset(alloca(sizeof(*hsa)), 0, sizeof(*hsa));
sprintfToken nextfmt;
@@ -3434,16 +3051,12 @@ char * headerSprintf(Header h, const char * fmt,
hsa->h = headerLink(h);
hsa->fmt = xstrdup(fmt);
-/*@-castexpose@*/ /* FIX: legacy API shouldn't change. */
hsa->exts = (headerSprintfExtension) extensions;
hsa->tags = (headerTagTableEntry) tbltags;
-/*@=castexpose@*/
hsa->errmsg = NULL;
-/*@-boundswrite@*/
if (parseFormat(hsa, hsa->fmt, &hsa->format, &hsa->numTokens, NULL, PARSER_BEGIN))
goto exit;
-/*@=boundswrite@*/
hsa->ec = rpmecNew(hsa->exts);
hsa->val = xstrdup("");
@@ -3459,9 +3072,7 @@ char * headerSprintf(Header h, const char * fmt,
if (isxml) {
need = sizeof("<rpmHeader>\n") - 1;
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, "<rpmHeader>\n");
-/*@=boundswrite@*/
hsa->vallen += (te - t);
}
@@ -3478,9 +3089,7 @@ char * headerSprintf(Header h, const char * fmt,
if (isxml) {
need = sizeof("</rpmHeader>\n") - 1;
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, "</rpmHeader>\n");
-/*@=boundswrite@*/
hsa->vallen += (te - t);
}
@@ -3491,10 +3100,8 @@ char * headerSprintf(Header h, const char * fmt,
hsa->format = freeFormat(hsa->format, hsa->numTokens);
exit:
-/*@-dependenttrans -observertrans @*/
if (errmsg)
*errmsg = hsa->errmsg;
-/*@=dependenttrans =observertrans @*/
hsa->h = headerFree(hsa->h);
hsa->fmt = _free(hsa->fmt);
return hsa->val;
@@ -3509,8 +3116,7 @@ exit:
* @return formatted string
*/
static char * octalFormat(int_32 type, hPTR_t data,
- char * formatPrefix, int padding, /*@unused@*/int element)
- /*@modifies formatPrefix @*/
+ char * formatPrefix, int padding,int element)
{
char * val;
@@ -3518,12 +3124,8 @@ static char * octalFormat(int_32 type, hPTR_t data,
val = xstrdup(_("(not a number)"));
} else {
val = xmalloc(20 + padding);
-/*@-boundswrite@*/
strcat(formatPrefix, "o");
-/*@=boundswrite@*/
- /*@-formatconst@*/
sprintf(val, formatPrefix, *((int_32 *) data));
- /*@=formatconst@*/
}
return val;
@@ -3538,8 +3140,7 @@ static char * octalFormat(int_32 type, hPTR_t data,
* @return formatted string
*/
static char * hexFormat(int_32 type, hPTR_t data,
- char * formatPrefix, int padding, /*@unused@*/int element)
- /*@modifies formatPrefix @*/
+ char * formatPrefix, int padding,int element)
{
char * val;
@@ -3547,12 +3148,8 @@ static char * hexFormat(int_32 type, hPTR_t data,
val = xstrdup(_("(not a number)"));
} else {
val = xmalloc(20 + padding);
-/*@-boundswrite@*/
strcat(formatPrefix, "x");
-/*@=boundswrite@*/
- /*@-formatconst@*/
sprintf(val, formatPrefix, *((int_32 *) data));
- /*@=formatconst@*/
}
return val;
@@ -3561,9 +3158,8 @@ static char * hexFormat(int_32 type, hPTR_t data,
/**
*/
static char * realDateFormat(int_32 type, hPTR_t data,
- char * formatPrefix, int padding, /*@unused@*/int element,
+ char * formatPrefix, int padding,int element,
const char * strftimeFormat)
- /*@modifies formatPrefix @*/
{
char * val;
@@ -3574,9 +3170,7 @@ static char * realDateFormat(int_32 type, hPTR_t data,
char buf[50];
val = xmalloc(50 + padding);
-/*@-boundswrite@*/
strcat(formatPrefix, "s");
-/*@=boundswrite@*/
/* this is important if sizeof(int_32) ! sizeof(time_t) */
{ time_t dateint = *((int_32 *) data);
@@ -3585,9 +3179,7 @@ static char * realDateFormat(int_32 type, hPTR_t data,
buf[0] = '\0';
if (tstruct)
(void) strftime(buf, sizeof(buf) - 1, strftimeFormat, tstruct);
- /*@-formatconst@*/
sprintf(val, formatPrefix, buf);
- /*@=formatconst@*/
}
return val;
@@ -3603,7 +3195,6 @@ static char * realDateFormat(int_32 type, hPTR_t data,
*/
static char * dateFormat(int_32 type, hPTR_t data,
char * formatPrefix, int padding, int element)
- /*@modifies formatPrefix @*/
{
return realDateFormat(type, data, formatPrefix, padding, element,
_("%c"));
@@ -3619,7 +3210,6 @@ static char * dateFormat(int_32 type, hPTR_t data,
*/
static char * dayFormat(int_32 type, hPTR_t data,
char * formatPrefix, int padding, int element)
- /*@modifies formatPrefix @*/
{
return realDateFormat(type, data, formatPrefix, padding, element,
_("%a %b %d %Y"));
@@ -3634,29 +3224,19 @@ static char * dayFormat(int_32 type, hPTR_t data,
* @return formatted string
*/
static char * shescapeFormat(int_32 type, hPTR_t data,
- char * formatPrefix, int padding, /*@unused@*/int element)
- /*@modifies formatPrefix @*/
+ char * formatPrefix, int padding,int element)
{
char * result, * dst, * src, * buf;
if (type == RPM_INT32_TYPE) {
result = xmalloc(padding + 20);
-/*@-boundswrite@*/
strcat(formatPrefix, "d");
-/*@=boundswrite@*/
- /*@-formatconst@*/
sprintf(result, formatPrefix, *((int_32 *) data));
- /*@=formatconst@*/
} else {
buf = alloca(strlen(data) + padding + 2);
-/*@-boundswrite@*/
strcat(formatPrefix, "s");
-/*@=boundswrite@*/
- /*@-formatconst@*/
sprintf(buf, formatPrefix, data);
- /*@=formatconst@*/
-/*@-boundswrite@*/
result = dst = xmalloc(strlen(buf) * 4 + 3);
*dst++ = '\'';
for (src = buf; *src != '\0'; src++) {
@@ -3671,14 +3251,13 @@ static char * shescapeFormat(int_32 type, hPTR_t data,
}
*dst++ = '\'';
*dst = '\0';
-/*@=boundswrite@*/
}
return result;
}
-/*@-type@*/ /* FIX: cast? */
+/* FIX: cast? */
const struct headerSprintfExtension_s headerDefaultFormats[] = {
{ HEADER_EXT_FORMAT, "octal", { octalFormat } },
{ HEADER_EXT_FORMAT, "hex", { hexFormat } },
@@ -3687,7 +3266,6 @@ const struct headerSprintfExtension_s headerDefaultFormats[] = {
{ HEADER_EXT_FORMAT, "shescape", { shescapeFormat } },
{ HEADER_EXT_LAST, NULL, { NULL } }
};
-/*@=type@*/
/** \ingroup header
* Duplicate tag values from one header into another.
@@ -3697,7 +3275,6 @@ const struct headerSprintfExtension_s headerDefaultFormats[] = {
*/
static
void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
- /*@modifies headerTo @*/
{
int * p;
@@ -3710,17 +3287,14 @@ void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
int_32 count;
if (headerIsEntry(headerTo, *p))
continue;
-/*@-boundswrite@*/
if (!headerGetEntryMinMemory(headerFrom, *p, &type,
(hPTR_t *) &s, &count))
continue;
-/*@=boundswrite@*/
(void) headerAddEntry(headerTo, *p, type, s, count);
s = headerFreeData(s, type);
}
}
-/*@observer@*/ /*@unchecked@*/
static struct HV_s hdrVec1 = {
headerLink,
headerUnlink,
@@ -3755,7 +3329,4 @@ static struct HV_s hdrVec1 = {
1
};
-/*@-compmempass -redef@*/
-/*@observer@*/ /*@unchecked@*/
HV_t hdrVec = &hdrVec1;
-/*@=compmempass =redef@*/
diff --git a/rpmdb/header.h b/rpmdb/header.h
index 4a097a0a8..9cf9e8dcf 100644
--- a/rpmdb/header.h
+++ b/rpmdb/header.h
@@ -100,7 +100,6 @@ typedef unsigned int uint_32;
typedef unsigned short uint_16;
typedef unsigned char uint_8;
-/*@-redef@*/ /* LCL: no clue */
/** \ingroup header
*/
typedef const char * errmsg_t;
@@ -114,18 +113,17 @@ typedef int_32 * hCNT_t;
/** \ingroup header
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct headerToken_s * Header;
+typedef struct headerToken_s * Header;
/** \ingroup header
*/
-typedef /*@abstract@*/ struct headerIterator_s * HeaderIterator;
+typedef struct headerIterator_s * HeaderIterator;
/** \ingroup header
* Associate tag names with numeric values.
*/
-typedef /*@abstract@*/ struct headerTagTableEntry_s * headerTagTableEntry;
+typedef struct headerTagTableEntry_s * headerTagTableEntry;
struct headerTagTableEntry_s {
-/*@observer@*/ /*@null@*/
const char * name; /*!< Tag name. */
int val; /*!< Tag numeric value. */
int type; /*!< Tag type. */
@@ -133,27 +131,20 @@ struct headerTagTableEntry_s {
/**
*/
-typedef /*@abstract@*/ struct headerTagIndices_s * headerTagIndices;
+typedef struct headerTagIndices_s * headerTagIndices;
struct headerTagIndices_s {
int (*loadIndex) (headerTagTableEntry ** ipp, int * np,
- int (*cmp) (const void * avp, const void * bvp))
- /*@ modifies *ipp, *np */; /*!< load sorted tag index. */
-/*@relnull@*/
+ int (*cmp) (const void * avp, const void * bvp));
+ /*!< load sorted tag index. */
headerTagTableEntry * byName; /*!< header tags sorted by name. */
int byNameSize; /*!< no. of entries. */
- int (*byNameCmp) (const void * avp, const void * bvp)
- /*@*/; /*!< compare entries by name. */
- int (*tagValue) (const char * name)
- /*@*/; /* return value from name. */
-/*@relnull@*/
+ int (*byNameCmp) (const void * avp, const void * bvp); /*!< compare entries by name. */
+ int (*tagValue) (const char * name); /* return value from name. */
headerTagTableEntry * byValue; /*!< header tags sorted by value. */
int byValueSize; /*!< no. of entries. */
- int (*byValueCmp) (const void * avp, const void * bvp)
- /*@*/; /*!< compare entries by value. */
- const char * (*tagName) (int value)
- /*@*/; /* Return name from value. */
- int (*tagType) (int value)
- /*@*/; /* Return type from value. */
+ int (*byValueCmp) (const void * avp, const void * bvp); /*!< compare entries by value. */
+ const char * (*tagName) (int value); /* Return name from value. */
+ int (*tagType) (int value); /* Return type from value. */
};
/** \ingroup header
@@ -179,8 +170,7 @@ enum headerSprintfExtensionType {
*/
typedef /*only@*/ char * (*headerTagFormatFunction)(int_32 type,
const void * data, char * formatPrefix,
- int padding, int element)
- /*@requires maxSet(data) >= 0 @*/;
+ int padding, int element);
/** \ingroup header
* HEADER_EXT_FORMAT format function prototype.
@@ -194,23 +184,19 @@ typedef /*only@*/ char * (*headerTagFormatFunction)(int_32 type,
* @return 0 on success
*/
typedef int (*headerTagTagFunction) (Header h,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * data,
- /*@null@*/ /*@out@*/ hCNT_t count,
- /*@null@*/ /*@out@*/ int * freeData)
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/;
+ hTYP_t type,
+ hPTR_t * data,
+ hCNT_t count,
+ int * freeData);
/** \ingroup header
* Define header tag output formats.
*/
-typedef /*@abstract@*/ struct headerSprintfExtension_s * headerSprintfExtension;
+typedef struct headerSprintfExtension_s * headerSprintfExtension;
struct headerSprintfExtension_s {
enum headerSprintfExtensionType type; /*!< Type of extension. */
-/*@observer@*/ /*@null@*/
const char * name; /*!< Name of extension. */
union {
-/*@observer@*/ /*@null@*/
void * generic; /*!< Private extension. */
headerTagFormatFunction formatFunction; /*!< HEADER_EXT_TAG extension. */
headerTagTagFunction tagFunction; /*!< HEADER_EXT_FORMAT extension. */
@@ -221,10 +207,7 @@ struct headerSprintfExtension_s {
/** \ingroup header
* Supported default header tag output formats.
*/
-/*@-redecl@*/
-/*@observer@*/
extern const struct headerSprintfExtension_s headerDefaultFormats[];
-/*@=redecl@*/
/** \ingroup header
* Include calculation for 8 bytes of (magic, 0)?
@@ -261,7 +244,6 @@ typedef enum rpmTagType_e {
* value of the tag a 16 byte image of what should/will be in the header index,
* followed by per-tag private data.
*/
-/*@-enummemuse -typeuse @*/
typedef enum rpmSubTagType_e {
RPM_REGION_TYPE = -10,
RPM_BIN_ARRAY_TYPE = -11,
@@ -271,12 +253,10 @@ typedef enum rpmSubTagType_e {
/*!<@todo Implement, intent is to to carry a (???,tagNum,valNum) cross
reference to retrieve data from other tags. */
} rpmSubTagType;
-/*@=enummemuse =typeuse @*/
/** \ingroup header
* * Identify how to return the header data type.
* */
-/*@-enummemuse -typeuse @*/
typedef enum rpmTagReturnType_e {
RPM_ANY_RETURN_TYPE = 0,
RPM_SCALAR_RETURN_TYPE = 0x00010000,
@@ -284,7 +264,6 @@ typedef enum rpmTagReturnType_e {
RPM_MAPPING_RETURN_TYPE = 0x00040000,
RPM_MASK_RETURN_TYPE = 0xffff0000
} rpmTagReturnType;
-/*@=enummemuse =typeuse @*/
/**
* Header private tags.
@@ -300,7 +279,6 @@ typedef enum rpmTagReturnType_e {
/**
*/
-/*@-typeuse -fielduse@*/
typedef union hRET_s {
const void * ptr;
const char ** argv;
@@ -311,33 +289,25 @@ typedef union hRET_s {
int_16 * i16p;
int_8 * i8p;
} * hRET_t;
-/*@=typeuse =fielduse@*/
/**
*/
-/*@-typeuse -fielduse@*/
typedef struct HE_s {
int_32 tag;
-/*@null@*/
hTYP_t typ;
union {
-/*@null@*/
hPTR_t * ptr;
-/*@null@*/
hRET_t * ret;
} u;
-/*@null@*/
hCNT_t cnt;
} * HE_t;
-/*@=typeuse =fielduse@*/
/** \ingroup header
* Create new (empty) header instance.
* @return header
*/
typedef
-Header (*HDRnew) (void)
- /*@*/;
+Header (*HDRnew) (void);
/** \ingroup header
* Dereference a header instance.
@@ -345,8 +315,7 @@ Header (*HDRnew) (void)
* @return NULL always
*/
typedef
-/*@null@*/ Header (*HDRfree) (/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/;
+Header (*HDRfree) (Header h);
/** \ingroup header
* Reference a header instance.
@@ -354,8 +323,7 @@ typedef
* @return referenced header instance
*/
typedef
-Header (*HDRlink) (Header h)
- /*@modifies h @*/;
+Header (*HDRlink) (Header h);
/** \ingroup header
* Dereference a header instance.
@@ -363,8 +331,7 @@ Header (*HDRlink) (Header h)
* @return NULL always
*/
typedef
-Header (*HDRunlink) (/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/;
+Header (*HDRunlink) (Header h);
/** \ingroup header
* Sort tags in header.
@@ -372,8 +339,7 @@ Header (*HDRunlink) (/*@killref@*/ /*@null@*/ Header h)
* @param h header
*/
typedef
-void (*HDRsort) (Header h)
- /*@modifies h @*/;
+void (*HDRsort) (Header h);
/** \ingroup header
* Restore tags in header to original ordering.
@@ -381,8 +347,7 @@ void (*HDRsort) (Header h)
* @param h header
*/
typedef
-void (*HDRunsort) (Header h)
- /*@modifies h @*/;
+void (*HDRunsort) (Header h);
/** \ingroup header
* Return size of on-disk header representation in bytes.
@@ -391,8 +356,7 @@ void (*HDRunsort) (Header h)
* @return size of on-disk header
*/
typedef
-unsigned int (*HDRsizeof) (/*@null@*/ Header h, enum hMagic magicp)
- /*@modifies h @*/;
+unsigned int (*HDRsizeof) (Header h, enum hMagic magicp);
/** \ingroup header
* Convert header to on-disk representation.
@@ -400,8 +364,7 @@ unsigned int (*HDRsizeof) (/*@null@*/ Header h, enum hMagic magicp)
* @return on-disk header blob (i.e. with offsets)
*/
typedef
-/*@only@*/ /*@null@*/ void * (*HDRunload) (Header h)
- /*@modifies h @*/;
+void * (*HDRunload) (Header h);
/** \ingroup header
* Convert header to on-disk representation, and then reload.
@@ -411,8 +374,7 @@ typedef
* @return on-disk header (with offsets)
*/
typedef
-/*@null@*/ Header (*HDRreload) (/*@only@*/ Header h, int tag)
- /*@modifies h @*/;
+Header (*HDRreload) (Header h, int tag);
/** \ingroup header
* Duplicate a header.
@@ -420,8 +382,7 @@ typedef
* @return new header instance
*/
typedef
-Header (*HDRcopy) (Header h)
- /*@modifies h @*/;
+Header (*HDRcopy) (Header h);
/** \ingroup header
* Convert header to in-memory representation.
@@ -429,8 +390,7 @@ Header (*HDRcopy) (Header h)
* @return header
*/
typedef
-/*@null@*/ Header (*HDRload) (/*@kept@*/ void * uh)
- /*@modifies uh @*/;
+Header (*HDRload) (void * uh);
/** \ingroup header
* Make a copy and convert header to in-memory representation.
@@ -438,8 +398,7 @@ typedef
* @return header
*/
typedef
-/*@null@*/ Header (*HDRcopyload) (const void * uh)
- /*@*/;
+Header (*HDRcopyload) (const void * uh);
/** \ingroup header
* Read (and load) header from file handle.
@@ -448,8 +407,7 @@ typedef
* @return header (or NULL on error)
*/
typedef
-/*@null@*/ Header (*HDRread) (FD_t fd, enum hMagic magicp)
- /*@modifies fd @*/;
+Header (*HDRread) (FD_t fd, enum hMagic magicp);
/** \ingroup header
* Write (with unload) header to file handle.
@@ -459,9 +417,7 @@ typedef
* @return 0 on success, 1 on error
*/
typedef
-int (*HDRwrite) (FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
- /*@globals fileSystem @*/
- /*@modifies fd, h, fileSystem @*/;
+int (*HDRwrite) (FD_t fd, Header h, enum hMagic magicp);
/** \ingroup header
* Check if tag is in header.
@@ -470,8 +426,7 @@ int (*HDRwrite) (FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRisentry) (/*@null@*/Header h, int_32 tag)
- /*@*/;
+int (*HDRisentry) (Header h, int_32 tag);
/** \ingroup header
* Free data allocated when retrieved from header.
@@ -481,9 +436,8 @@ int (*HDRisentry) (/*@null@*/Header h, int_32 tag)
* @return NULL always
*/
typedef
-/*@null@*/ void * (*HDRfreetag) (Header h,
- /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
- /*@modifies data @*/;
+void * (*HDRfreetag) (Header h,
+ const void * data, rpmTagType type);
/** \ingroup header
* Retrieve tag value.
@@ -500,10 +454,9 @@ typedef
*/
typedef
int (*HDRget) (Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void ** p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/;
+ hTYP_t type,
+ void ** p,
+ hCNT_t c);
/** \ingroup header
* Retrieve tag value using header internal array.
@@ -519,10 +472,9 @@ int (*HDRget) (Header h, int_32 tag,
*/
typedef
int (*HDRgetmin) (Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/;
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c);
/** \ingroup header
* Add tag to header.
@@ -539,8 +491,7 @@ int (*HDRgetmin) (Header h, int_32 tag,
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRadd) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/;
+int (*HDRadd) (Header h, int_32 tag, int_32 type, const void * p, int_32 c);
/** \ingroup header
* Append element to tag array in header.
@@ -557,8 +508,7 @@ int (*HDRadd) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/;
+int (*HDRappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c);
/** \ingroup header
* Add or append element to tag array in header.
@@ -571,8 +521,7 @@ int (*HDRappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRaddorappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/;
+int (*HDRaddorappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c);
/** \ingroup header
* Add locale specific tag to header.
@@ -596,8 +545,7 @@ int (*HDRaddorappend) (Header h, int_32 tag, int_32 type, const void * p, int_32
*/
typedef
int (*HDRaddi18n) (Header h, int_32 tag, const char * string,
- const char * lang)
- /*@modifies h @*/;
+ const char * lang);
/** \ingroup header
* Modify tag in header.
@@ -610,8 +558,7 @@ int (*HDRaddi18n) (Header h, int_32 tag, const char * string,
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRmodify) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/;
+int (*HDRmodify) (Header h, int_32 tag, int_32 type, const void * p, int_32 c);
/** \ingroup header
* Delete tag in header.
@@ -623,8 +570,7 @@ int (*HDRmodify) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
* @return 0 on success, 1 on failure (INCONSISTENT)
*/
typedef
-int (*HDRremove) (Header h, int_32 tag)
- /*@modifies h @*/;
+int (*HDRremove) (Header h, int_32 tag);
/** \ingroup header
* Return formatted output string from header tags.
@@ -638,11 +584,10 @@ int (*HDRremove) (Header h, int_32 tag)
* @return formatted output string (malloc'ed)
*/
typedef
-/*@only@*/ char * (*HDRsprintf) (Header h, const char * fmt,
+char * (*HDRsprintf) (Header h, const char * fmt,
const struct headerTagTableEntry_s * tags,
const struct headerSprintfExtension_s * extensions,
- /*@null@*/ /*@out@*/ errmsg_t * errmsg)
- /*@modifies *errmsg @*/;
+ errmsg_t * errmsg);
/** \ingroup header
* Duplicate tag values from one header into another.
@@ -651,8 +596,7 @@ typedef
* @param tagstocopy array of tags that are copied
*/
typedef
-void (*HDRcopytags) (Header headerFrom, Header headerTo, hTAG_t tagstocopy)
- /*@modifies headerFrom, headerTo @*/;
+void (*HDRcopytags) (Header headerFrom, Header headerTo, hTAG_t tagstocopy);
/** \ingroup header
* Destroy header tag iterator.
@@ -660,8 +604,7 @@ void (*HDRcopytags) (Header headerFrom, Header headerTo, hTAG_t tagstocopy)
* @return NULL always
*/
typedef
-HeaderIterator (*HDRfreeiter) (/*@only@*/ HeaderIterator hi)
- /*@modifies hi @*/;
+HeaderIterator (*HDRfreeiter) (HeaderIterator hi);
/** \ingroup header
* Create header tag iterator.
@@ -669,8 +612,7 @@ HeaderIterator (*HDRfreeiter) (/*@only@*/ HeaderIterator hi)
* @return header tag iterator
*/
typedef
-HeaderIterator (*HDRinititer) (Header h)
- /*@modifies h */;
+HeaderIterator (*HDRinititer) (Header h);
/** \ingroup header
* Return next tag from header.
@@ -683,16 +625,15 @@ HeaderIterator (*HDRinititer) (Header h)
*/
typedef
int (*HDRnextiter) (HeaderIterator hi,
- /*@null@*/ /*@out@*/ hTAG_t tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies hi, *tag, *type, *p, *c @*/;
+ hTAG_t tag,
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c);
/** \ingroup header
* Header method vectors.
*/
-typedef /*@abstract@*/ struct HV_s * HV_t;
+typedef struct HV_s * HV_t;
struct HV_s {
HDRlink hdrlink;
HDRunlink hdrunlink;
@@ -723,9 +664,7 @@ struct HV_s {
HDRfreeiter hdrfreeiter;
HDRinititer hdrinititer;
HDRnextiter hdrnextiter;
-/*@null@*/
void * hdrvecs;
-/*@null@*/
void * hdrdata;
int hdrversion;
};
@@ -739,18 +678,15 @@ struct HV_s {
* @param type type of data (or -1 to force free)
* @return NULL always
*/
-/*@unused@*/ static inline /*@null@*/
-void * headerFreeData( /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
- /*@modifies data @*/
+static inline
+void * headerFreeData( const void * data, rpmTagType type)
{
if (data) {
- /*@-branchstate@*/
if (type == -1 ||
type == RPM_STRING_ARRAY_TYPE ||
type == RPM_I18NSTRING_TYPE ||
type == RPM_BIN_TYPE)
free((void *)data);
- /*@=branchstate@*/
}
return NULL;
}
diff --git a/rpmdb/header_internal.c b/rpmdb/header_internal.c
index 969ca1114..5cf86b775 100644
--- a/rpmdb/header_internal.c
+++ b/rpmdb/header_internal.c
@@ -1,4 +1,3 @@
-/*@-sizeoftype@*/
/** \ingroup header
* \file rpmdb/header_internal.c
*/
@@ -9,7 +8,6 @@
#include "debug.h"
-/*@-boundswrite@*/
char ** headerGetLangs(Header h)
{
char **s, *e, **table;
@@ -26,12 +24,10 @@ char ** headerGetLangs(Header h)
table[i] = e;
table[count] = NULL;
- /*@-nullret@*/ return table; /*@=nullret@*/ /* LCL: double indirection? */
+ return table; /* LCL: double indirection? */
}
-/*@=boundswrite@*/
-/*@-boundsread@*/
-/*@-type@*/ /* FIX: shrug */
+/* FIX: shrug */
void headerDump(Header h, FILE *f, int flags,
const struct headerTagTableEntry_s * tags)
{
@@ -52,35 +48,35 @@ void headerDump(Header h, FILE *f, int flags,
switch (p->info.type) {
case RPM_NULL_TYPE:
type = "NULL";
- /*@switchbreak@*/ break;
+ break;
case RPM_CHAR_TYPE:
type = "CHAR";
- /*@switchbreak@*/ break;
+ break;
case RPM_BIN_TYPE:
type = "BIN";
- /*@switchbreak@*/ break;
+ break;
case RPM_INT8_TYPE:
type = "INT8";
- /*@switchbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
type = "INT16";
- /*@switchbreak@*/ break;
+ break;
case RPM_INT32_TYPE:
type = "INT32";
- /*@switchbreak@*/ break;
+ break;
/*case RPM_INT64_TYPE: type = "INT64"; break;*/
case RPM_STRING_TYPE:
type = "STRING";
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_ARRAY_TYPE:
type = "STRING_ARRAY";
- /*@switchbreak@*/ break;
+ break;
case RPM_I18NSTRING_TYPE:
type = "I18N_STRING";
- /*@switchbreak@*/ break;
+ break;
default:
type = "(unknown)";
- /*@switchbreak@*/ break;
+ break;
}
tage = tags;
@@ -109,7 +105,7 @@ void headerDump(Header h, FILE *f, int flags,
(int) *((int_32 *) dp));
dp += sizeof(int_32);
}
- /*@switchbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
while (c--) {
@@ -118,7 +114,7 @@ void headerDump(Header h, FILE *f, int flags,
(int) *((int_16 *) dp));
dp += sizeof(int_16);
}
- /*@switchbreak@*/ break;
+ break;
case RPM_INT8_TYPE:
while (c--) {
fprintf(f, " Data: %.3d 0x%02x (%d)\n", ct++,
@@ -126,7 +122,7 @@ void headerDump(Header h, FILE *f, int flags,
(int) *((int_8 *) dp));
dp += sizeof(int_8);
}
- /*@switchbreak@*/ break;
+ break;
case RPM_BIN_TYPE:
while (c > 0) {
fprintf(f, " Data: %.3d ", ct);
@@ -135,12 +131,12 @@ void headerDump(Header h, FILE *f, int flags,
ct++;
dp += sizeof(int_8);
if (! (ct % 8)) {
- /*@loopbreak@*/ break;
+ break;
}
}
fprintf(f, "\n");
}
- /*@switchbreak@*/ break;
+ break;
case RPM_CHAR_TYPE:
while (c--) {
char ch = (char) *((char *) dp);
@@ -150,7 +146,7 @@ void headerDump(Header h, FILE *f, int flags,
(int) *((char *) dp));
dp += sizeof(char);
}
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
@@ -159,19 +155,16 @@ void headerDump(Header h, FILE *f, int flags,
dp = strchr(dp, 0);
dp++;
}
- /*@switchbreak@*/ break;
+ break;
default:
fprintf(stderr, _("Data type %d not supported\n"),
(int) p->info.type);
- /*@switchbreak@*/ break;
+ break;
}
}
p++;
}
}
-/*@=type@*/
-/*@=sizeoftype@*/
-/*@=boundsread@*/
char * bin2hex(const char *data, size_t size)
{
diff --git a/rpmdb/header_internal.h b/rpmdb/header_internal.h
index 5b310a71b..6ff9625e8 100644
--- a/rpmdb/header_internal.h
+++ b/rpmdb/header_internal.h
@@ -20,7 +20,7 @@
/** \ingroup header
* Description of tag data.
*/
-typedef /*@abstract@*/ struct entryInfo_s * entryInfo;
+typedef struct entryInfo_s * entryInfo;
struct entryInfo_s {
int_32 tag; /*!< Tag identifier. */
int_32 type; /*!< Tag data type. */
@@ -38,10 +38,9 @@ struct entryInfo_s {
/** \ingroup header
* A single tag from a Header.
*/
-typedef /*@abstract@*/ struct indexEntry_s * indexEntry;
+typedef struct indexEntry_s * indexEntry;
struct indexEntry_s {
struct entryInfo_s info; /*!< Description of tag data. */
-/*@owned@*/
void * data; /*!< Location of tag data. */
int length; /*!< No. bytes of data. */
int rdlen; /*!< No. bytes of data in region. */
@@ -51,11 +50,8 @@ struct indexEntry_s {
* The Header data structure.
*/
struct headerToken_s {
-/*@unused@*/
struct HV_s hv; /*!< Header public methods. */
-/*@only@*/ /*@null@*/
void * blob; /*!< Header region blob. */
-/*@owned@*/
indexEntry index; /*!< Array of tags. */
int indexUsed; /*!< Current size of tag array. */
int indexAlloced; /*!< Allocated size of tag array. */
@@ -64,25 +60,20 @@ struct headerToken_s {
#define HEADERFLAG_ALLOCATED (1 << 1) /*!< Is 1st header region allocated? */
#define HEADERFLAG_LEGACY (1 << 2) /*!< Header came from legacy source? */
#define HEADERFLAG_DEBUG (1 << 3) /*!< Debug this header? */
-/*@refs@*/
int nrefs; /*!< Reference count. */
};
/** \ingroup header
*/
-typedef /*@abstract@*/ struct sprintfTag_s * sprintfTag;
+typedef struct sprintfTag_s * sprintfTag;
struct sprintfTag_s {
-/*@null@*/
headerTagFormatFunction fmt;
-/*@null@*/
headerTagTagFunction ext; /*!< NULL if tag element is invalid */
int extNum;
int_32 tag;
int justOne;
int arrayCount;
-/*@kept@*/
char * format;
-/*@kept@*/ /*@null@*/
char * type;
int pad;
};
@@ -90,20 +81,18 @@ struct sprintfTag_s {
/** \ingroup header
* Extension cache.
*/
-typedef /*@abstract@*/ struct rpmec_s * rpmec;
+typedef struct rpmec_s * rpmec;
struct rpmec_s {
int_32 type;
int_32 count;
int avail;
int freeit;
-/*@owned@*/
const void * data;
};
/** \ingroup header
*/
-typedef /*@abstract@*/ struct sprintfToken_s * sprintfToken;
-/*@-fielduse@*/
+typedef struct sprintfToken_s * sprintfToken;
struct sprintfToken_s {
enum {
PTOK_NONE = 0,
@@ -115,28 +104,23 @@ struct sprintfToken_s {
union {
struct sprintfTag_s tag; /*!< PTOK_TAG */
struct {
- /*@only@*/
sprintfToken format;
int i;
int numTokens;
} array; /*!< PTOK_ARRAY */
struct {
- /*@dependent@*/
char * string;
int len;
} string; /*!< PTOK_STRING */
struct {
- /*@only@*/ /*@null@*/
sprintfToken ifFormat;
int numIfTokens;
- /*@only@*/ /*@null@*/
sprintfToken elseFormat;
int numElseTokens;
struct sprintfTag_s tag;
} cond; /*!< PTOK_COND */
} u;
};
-/*@=fielduse@*/
#ifdef __cplusplus
extern "C" {
@@ -148,9 +132,7 @@ extern "C" {
* @param h header
* @return array of locales (or NULL on error)
*/
-/*@unused@*/
-/*@only@*/ /*@null@*/ char ** headerGetLangs(Header h)
- /*@*/;
+char ** headerGetLangs(Header h);
/** \ingroup header
* Retrieve tag value with type match.
@@ -164,27 +146,20 @@ extern "C" {
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
-/*@-exportlocal@*/
-/*@-incondefs@*/
int headerGetRawEntry(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/;
-/*@=incondefs@*/
-/*@=exportlocal@*/
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c);
/** \ingroup header
* Return header reference count.
* @param h header
* @return no. of references
*/
-/*@-type@*/ /* FIX: cast? */
-/*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ {
+/* FIX: cast? */
+static inline int headerUsageCount(Header h) {
return h->nrefs;
}
-/*@=type@*/
/** \ingroup header
* Dump a header in human readable format (for debugging).
@@ -193,11 +168,8 @@ int headerGetRawEntry(Header h, int_32 tag,
* @param flags 0 or HEADER_DUMP_INLINE
* @param tags array of tag name/value pairs
*/
-/*@unused@*/
void headerDump(Header h, FILE *f, int flags,
- const struct headerTagTableEntry_s * tags)
- /*@globals fileSystem @*/
- /*@modifies f, fileSystem @*/;
+ const struct headerTagTableEntry_s * tags);
#define HEADER_DUMP_INLINE 1
/* XXX not perhaps the right place but.. */
diff --git a/rpmdb/legacy.c b/rpmdb/legacy.c
index efc9e7943..5959ecdbd 100644
--- a/rpmdb/legacy.c
+++ b/rpmdb/legacy.c
@@ -33,12 +33,8 @@
* @retval fsizep file size
* @return -1 on error, otherwise, an open file descriptor
*/
-static int open_dso(const char * path, /*@null@*/ pid_t * pidp, /*@null@*/ size_t *fsizep)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies *pidp, *fsizep, rpmGlobalMacroContext,
- fileSystem, internalState @*/
+static int open_dso(const char * path, pid_t * pidp, size_t *fsizep)
{
-/*@only@*/
static const char * cmd = NULL;
static int initted = 0;
int fdno;
@@ -48,7 +44,6 @@ static int open_dso(const char * path, /*@null@*/ pid_t * pidp, /*@null@*/ size_
initted++;
}
-/*@-boundswrite@*/
if (pidp) *pidp = 0;
if (fsizep) {
@@ -57,16 +52,13 @@ static int open_dso(const char * path, /*@null@*/ pid_t * pidp, /*@null@*/ size_
return -1;
*fsizep = st->st_size;
}
-/*@=boundswrite@*/
fdno = open(path, O_RDONLY);
if (fdno < 0)
return fdno;
-/*@-boundsread@*/
if (!(cmd && *cmd))
return fdno;
-/*@=boundsread@*/
#if HAVE_GELF_H && HAVE_LIBELF
{ Elf *elf = NULL;
@@ -79,16 +71,13 @@ static int open_dso(const char * path, /*@null@*/ pid_t * pidp, /*@null@*/ size_
(void) elf_version(EV_CURRENT);
-/*@-evalorder@*/
if ((elf = elf_begin (fdno, ELF_C_READ, NULL)) == NULL
|| elf_kind(elf) != ELF_K_ELF
|| gelf_getehdr(elf, &ehdr) == NULL
|| !(ehdr.e_type == ET_DYN || ehdr.e_type == ET_EXEC))
goto exit;
-/*@=evalorder@*/
bingo = 0;
- /*@-branchstate -uniondef @*/
while (!bingo && (scn = elf_nextscn(elf, scn)) != NULL) {
(void) gelf_getshdr(scn, &shdr);
if (shdr.sh_type != SHT_DYNAMIC)
@@ -100,15 +89,13 @@ static int open_dso(const char * path, /*@null@*/ pid_t * pidp, /*@null@*/ size_
for (ndx = 0; ndx < maxndx; ++ndx) {
(void) gelf_getdyn (data, ndx, &dyn);
if (!(dyn.d_tag == DT_GNU_PRELINKED || dyn.d_tag == DT_GNU_LIBLIST))
- /*@innercontinue@*/ continue;
+ continue;
bingo = 1;
- /*@innerbreak@*/ break;
+ break;
}
}
}
- /*@=branchstate =uniondef @*/
-/*@-boundswrite@*/
if (pidp != NULL && bingo) {
int pipes[2];
pid_t pid;
@@ -135,7 +122,6 @@ static int open_dso(const char * path, /*@null@*/ pid_t * pidp, /*@null@*/ size_
fdno = pipes[0];
xx = close(pipes[1]);
}
-/*@=boundswrite@*/
exit:
if (elf) (void) elf_end(elf);
@@ -158,9 +144,7 @@ int domd5(const char * fn, unsigned char * digest, int asAscii, size_t *fsizep)
int rc = 0;
int fdno;
-/*@-globs -internalglobs -mods @*/
fdno = open_dso(path, &pid, &fsize);
-/*@=globs =internalglobs =mods @*/
if (fdno < 0) {
rc = 1;
goto exit;
@@ -200,7 +184,7 @@ int domd5(const char * fn, unsigned char * digest, int asAscii, size_t *fsizep)
xx = munmap(mapped, fsize);
xx = close(fdno);
break;
- } /*@fallthrough@*/
+ }
#endif
case URL_IS_HTTPS:
case URL_IS_HTTP:
@@ -239,33 +223,24 @@ int domd5(const char * fn, unsigned char * digest, int asAscii, size_t *fsizep)
}
exit:
-/*@-boundswrite@*/
if (fsizep)
*fsizep = fsize;
if (!rc)
memcpy(digest, md5sum, md5len);
-/*@=boundswrite@*/
md5sum = _free(md5sum);
return rc;
}
-/*@-exportheadervar@*/
-/*@unchecked@*/
int _noDirTokens = 0;
-/*@=exportheadervar@*/
-/*@-boundsread@*/
static int dncmp(const void * a, const void * b)
- /*@*/
{
const char *const * first = a;
const char *const * second = b;
return strcmp(*first, *second);
}
-/*@=boundsread@*/
-/*@-bounds@*/
void compressFilelist(Header h)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
@@ -312,7 +287,6 @@ void compressFilelist(Header h)
goto exit;
}
- /*@-branchstate@*/
for (i = 0; i < count; i++) {
const char ** needle;
char savechar;
@@ -326,7 +300,6 @@ void compressFilelist(Header h)
needle = dirNames;
savechar = *baseName;
*baseName = '\0';
-/*@-compdef@*/
if (dirIndex < 0 ||
(needle = bsearch(&fileNames[i], dirNames, dirIndex + 1, sizeof(dirNames[0]), dncmp)) == NULL) {
char *s = alloca(len + 1);
@@ -336,12 +309,10 @@ void compressFilelist(Header h)
dirNames[dirIndex] = s;
} else
dirIndexes[i] = needle - dirNames;
-/*@=compdef@*/
*baseName = savechar;
baseNames[i] = baseName;
}
- /*@=branchstate@*/
exit:
if (count > 0) {
@@ -356,10 +327,9 @@ exit:
xx = hre(h, RPMTAG_OLDFILENAMES);
}
-/*@=bounds@*/
void rpmfiBuildFNames(Header h, rpmTag tagN,
- /*@out@*/ const char *** fnp, /*@out@*/ int * fcp)
+ const char *** fnp, int * fcp)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
@@ -398,22 +368,18 @@ void rpmfiBuildFNames(Header h, rpmTag tagN,
fileNames = xmalloc(size);
t = ((char *) fileNames) + (sizeof(*fileNames) * count);
- /*@-branchstate@*/
for (i = 0; i < count; i++) {
fileNames[i] = t;
t = stpcpy( stpcpy(t, dirNames[dirIndexes[i]]), baseNames[i]);
*t++ = '\0';
}
- /*@=branchstate@*/
baseNames = hfd(baseNames, bnt);
dirNames = hfd(dirNames, dnt);
- /*@-branchstate@*/
if (fnp)
*fnp = fileNames;
else
fileNames = _free(fileNames);
- /*@=branchstate@*/
if (fcp) *fcp = count;
}
@@ -425,7 +391,6 @@ void expandFilelist(Header h)
int count = 0;
int xx;
- /*@-branchstate@*/
if (!headerIsEntry(h, RPMTAG_OLDFILENAMES)) {
rpmfiBuildFNames(h, RPMTAG_BASENAMES, &fileNames, &count);
if (fileNames == NULL || count <= 0)
@@ -434,7 +399,6 @@ void expandFilelist(Header h)
fileNames, count);
fileNames = _free(fileNames);
}
- /*@=branchstate@*/
xx = hre(h, RPMTAG_DIRNAMES);
xx = hre(h, RPMTAG_BASENAMES);
@@ -499,7 +463,7 @@ void providePackageNVR(Header h)
xx = hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL);
- /*@-nullderef@*/ /* LCL: providesEVR is not NULL */
+ /* LCL: providesEVR is not NULL */
if (provides && providesEVR && provideFlags)
for (i = 0; i < providesCount; i++) {
if (!(provides[i] && providesEVR[i]))
@@ -510,7 +474,6 @@ void providePackageNVR(Header h)
bingo = 0;
break;
}
- /*@=nullderef@*/
exit:
provides = hfd(provides, pnt);
@@ -546,14 +509,12 @@ void legacyRetrofit(Header h, const struct rpmlead * lead)
* careful. This fixup makes queries give the new values though,
* which is quite handy.
*/
- /*@=branchstate@*/
if (headerGetEntry(h, RPMTAG_DEFAULTPREFIX, NULL, (void **) &prefix, NULL))
{
const char * nprefix = stripTrailingChar(alloca_strdup(prefix), '/');
(void) headerAddEntry(h, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE,
&nprefix, 1);
}
- /*@=branchstate@*/
/*
* The file list was moved to a more compressed format which not
diff --git a/rpmdb/legacy.h b/rpmdb/legacy.h
index adde0a67c..69b54d635 100644
--- a/rpmdb/legacy.h
+++ b/rpmdb/legacy.h
@@ -8,10 +8,7 @@
/**
*/
-/*@-redecl@*/
-/*@unchecked@*/
extern int _noDirTokens;
-/*@=redecl@*/
#ifdef __cplusplus
extern "C" {
@@ -25,17 +22,14 @@ extern "C" {
* @retval *fsizep file size pointer (or NULL)
* @return 0 on success, 1 on error
*/
-int domd5(const char * fn, /*@out@*/ unsigned char * digest, int asAscii,
- /*@null@*/ /*@out@*/ size_t *fsizep)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies digest, *fsizep, fileSystem, internalState @*/;
+int domd5(const char * fn, unsigned char * digest, int asAscii,
+ size_t *fsizep);
/**
* Convert absolute path tag to (dirname,basename,dirindex) tags.
* @param h header
*/
-void compressFilelist(Header h)
- /*@modifies h @*/;
+void compressFilelist(Header h);
/**
* Retrieve file names from header.
@@ -55,31 +49,27 @@ void compressFilelist(Header h)
* @retval *fcp number of files
*/
void rpmfiBuildFNames(Header h, rpmTag tagN,
- /*@out@*/ const char *** fnp, /*@out@*/ int * fcp)
- /*@modifies *fnp, *fcp @*/;
+ const char *** fnp, int * fcp);
/**
* Convert (dirname,basename,dirindex) tags to absolute path tag.
* @param h header
*/
-void expandFilelist(Header h)
- /*@modifies h @*/;
+void expandFilelist(Header h);
/**
* Retrofit a Provides: name = version-release dependency into legacy
* package headers.
* @param h header
*/
-void providePackageNVR(Header h)
- /*@modifies h @*/;
+void providePackageNVR(Header h);
/**
* Do all necessary retorfits for a package header.
* @param h header
* @param lead
*/
-void legacyRetrofit(Header h, const struct rpmlead * lead)
- /*@modifies h@*/;
+void legacyRetrofit(Header h, const struct rpmlead * lead);
#ifdef __cplusplus
}
diff --git a/rpmdb/merge.c b/rpmdb/merge.c
index e65373382..73e68c056 100644
--- a/rpmdb/merge.c
+++ b/rpmdb/merge.c
@@ -1,4 +1,3 @@
-/*@-bounds -mustmod -sizeoftype @*/
#ifndef __APPLE__
/*-
* Copyright (c) 1992, 1993
@@ -113,7 +112,6 @@ static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
static void
insertionsort(unsigned char *a, size_t n, size_t size,
int (*cmp) (const void *, const void *))
- /*@modifies *a @*/
{
u_char *ai, *s, *t, *u, tmp;
int i;
@@ -122,7 +120,7 @@ insertionsort(unsigned char *a, size_t n, size_t size,
for (t = ai; t > a; t -= size) {
u = t - size;
if (cmp(u, t) <= 0)
- /*@innerbreak@*/ break;
+ break;
swap(u, t);
}
}
@@ -134,9 +132,8 @@ insertionsort(unsigned char *a, size_t n, size_t size,
* is defined. Otherwise simple pairwise merging is used.)
*/
static void
-setup(unsigned char *list1, /*@out@*/ unsigned char *list2,
+setup(unsigned char *list1, unsigned char *list2,
size_t n, size_t size, int (*cmp) (const void *, const void *))
- /*@modifies list1, list2 @*/
{
int i, length, size2, tmp, sense;
unsigned char *f1, *f2, *s, *l2, *last, *p2;
@@ -165,7 +162,7 @@ setup(unsigned char *list1, /*@out@*/ unsigned char *list2,
/* Find pairs with same sense. */
for (f2 = f1 + size2; f2 < last; f2 += size2) {
if ((cmp(f2, f2+ size) > 0) != sense)
- /*@innerbreak@*/ break;
+ break;
length += 2;
}
if (length < THRESHOLD) { /* Pairwise merge */
@@ -212,11 +209,8 @@ mergesort(void *base, size_t nmemb, size_t size,
register int i, sense;
int big, iflag;
register unsigned char *f1, *f2, *t, *b, *q, *l1, *l2;
- /*@dependent@*/
register unsigned char *tp2;
- /*@owned@*/
unsigned char *list2;
- /*@dependent@*/
unsigned char *list1;
unsigned char *p2, *p, *last, **p1;
@@ -243,7 +237,6 @@ mergesort(void *base, size_t nmemb, size_t size,
setup(list1, list2, nmemb, size, cmp);
last = list2 + nmemb * size;
i = big = 0;
-/*@-branchstate@*/
while (*EVAL(list2) != last) {
l2 = list1;
p1 = EVAL(list1);
@@ -271,7 +264,6 @@ mergesort(void *base, size_t nmemb, size_t size,
goto EXPONENTIAL;
}
} else {
-/*@-shiftimplementation@*/
EXPONENTIAL: for (i = size; ; i <<= 1)
if ((p = (b + i)) >= t) {
if ((p = t - size) > b &&
@@ -279,7 +271,7 @@ EXPONENTIAL: for (i = size; ; i <<= 1)
t = p;
else
b = p;
- /*@innerbreak@*/ break;
+ break;
} else if ((*cmp)(q, p) <= sense) {
t = p;
if (i == size)
@@ -287,7 +279,6 @@ EXPONENTIAL: for (i = size; ; i <<= 1)
goto FASTCASE;
} else
b = p;
- /*@-infloopsuncon@*/
while (t > b+size) {
i = (((t - b) / size) >> 1) * size;
if ((*cmp)(q, p = b + i) <= sense)
@@ -302,8 +293,6 @@ FASTCASE: while (i > size)
t = p;
else
b = p;
- /*@=infloopsuncon@*/
-/*@=shiftimplementation@*/
COPY: b = t;
}
i = size;
@@ -338,24 +327,18 @@ COPY: b = t;
}
*p1 = l2;
}
-/*@-dependenttrans@*/
tp2 = list1; /* swap list1, list2 */
list1 = list2;
list2 = tp2;
-/*@=dependenttrans@*/
last = list2 + nmemb*size;
}
-/*@=branchstate@*/
if (base == list2) {
memmove(list2, list1, nmemb*size);
list2 = list1;
}
-/*@-usereleased@*/
free(list2);
-/*@=usereleased@*/
return (0);
}
#else
/* mergesort is implemented in System on Mac OS X */
#endif /* __APPLE__ */
-/*@=bounds =mustmod =sizeoftype @*/
diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c
index f29ad7ab9..ca4eba155 100644
--- a/rpmdb/rpmdb.c
+++ b/rpmdb/rpmdb.c
@@ -9,9 +9,7 @@
#include <sys/file.h>
#ifndef DYING /* XXX already in "system.h" */
-/*@-noparams@*/
#include <fnmatch.h>
-/*@=noparams@*/
#endif
#include <regex.h>
@@ -26,48 +24,31 @@
#include "header_internal.h" /* XXX for HEADERFLAG_ALLOCATED */
#include "debug.h"
-/*@access dbiIndexSet@*/
-/*@access dbiIndexItem@*/
-/*@access rpmts@*/ /* XXX compared with NULL */
-/*@access Header@*/ /* XXX compared with NULL */
-/*@access rpmdbMatchIterator@*/
-/*@access pgpDig@*/
-
-/*@unchecked@*/
int _rpmdb_debug = 0;
-/*@unchecked@*/
static int _rebuildinprogress = 0;
-/*@unchecked@*/
static int _db_filter_dups = 0;
#define _DBI_FLAGS 0
#define _DBI_PERMS 0644
#define _DBI_MAJOR -1
-/*@unchecked@*/
-/*@globstate@*/ /*@null@*/ int * dbiTags = NULL;
-/*@unchecked@*/
+int * dbiTags = NULL;
int dbiTagsMax = 0;
/* We use this to comunicate back to the the rpm transaction
* what their install instance was on a rpmdbAdd().
*/
-/*@unchecked@*/
unsigned int myinstall_instance = 0;
/* Bit mask macros. */
-/*@-exporttype@*/
typedef unsigned int __pbm_bits;
-/*@=exporttype@*/
#define __PBM_NBITS (8 * sizeof (__pbm_bits))
#define __PBM_IX(d) ((d) / __PBM_NBITS)
#define __PBM_MASK(d) ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS))
-/*@-exporttype@*/
typedef struct {
__pbm_bits bits[1];
} pbm_set;
-/*@=exporttype@*/
#define __PBM_BITS(set) ((set)->bits)
#define PBM_FREE(s) _free(s);
@@ -83,27 +64,19 @@ typedef struct {
* @retval odp no. of bits in map
* @param nd desired no. of bits
*/
-/*@unused@*/
static inline pbm_set * PBM_REALLOC(pbm_set ** sp, int * odp, int nd)
- /*@modifies *sp, *odp @*/
{
int i, nb;
-/*@-bounds -sizeoftype@*/
if (nd > (*odp)) {
nd *= 2;
nb = __PBM_IX(nd) + 1;
-/*@-unqualifiedtrans@*/
*sp = xrealloc(*sp, nb * sizeof(__pbm_bits));
-/*@=unqualifiedtrans@*/
for (i = __PBM_IX(*odp) + 1; i < nb; i++)
__PBM_BITS(*sp)[i] = 0;
*odp = nd;
}
-/*@=bounds =sizeoftype@*/
-/*@-compdef -retalias -usereleased@*/
return *sp;
-/*@=compdef =retalias =usereleased@*/
}
/**
@@ -112,7 +85,6 @@ static inline pbm_set * PBM_REALLOC(pbm_set ** sp, int * odp, int nd)
* @return binary nibble
*/
static inline unsigned char nibble(char c)
- /*@*/
{
if (c >= '0' && c <= '9')
return (c - '0');
@@ -130,7 +102,7 @@ static inline unsigned char nibble(char c)
* @param len key value length
* @return 1 if only ASCII, 0 otherwise.
*/
-static int printable(const void * ptr, size_t len) /*@*/
+static int printable(const void * ptr, size_t len)
{
const char * s = ptr;
int i;
@@ -146,16 +118,13 @@ static int printable(const void * ptr, size_t len) /*@*/
* @return dbi index, -1 on error
*/
static int dbiTagToDbix(int rpmtag)
- /*@*/
{
int dbix;
if (dbiTags != NULL)
for (dbix = 0; dbix < dbiTagsMax; dbix++) {
-/*@-boundsread@*/
if (rpmtag == dbiTags[dbix])
return dbix;
-/*@=boundsread@*/
}
return -1;
}
@@ -164,10 +133,7 @@ static int dbiTagToDbix(int rpmtag)
* Initialize database (index, tag) tuple from configuration.
*/
static void dbiTagsInit(void)
- /*@globals dbiTags, dbiTagsMax, rpmGlobalMacroContext, h_errno @*/
- /*@modifies dbiTags, dbiTagsMax, rpmGlobalMacroContext @*/
{
-/*@observer@*/
static const char * const _dbiTagStr_default =
"Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filemd5s:Depends:Pubkeys";
char * dbiTagStr = NULL;
@@ -195,9 +161,9 @@ static void dbiTagsInit(void)
break;
for (oe = o; oe && *oe; oe++) {
if (xisspace(*oe))
- /*@innerbreak@*/ break;
+ break;
if (oe[0] == ':' && !(oe[1] == '/' && oe[2] == '/'))
- /*@innerbreak@*/ break;
+ break;
}
if (oe && *oe)
*oe++ = '\0';
@@ -217,40 +183,28 @@ static void dbiTagsInit(void)
dbiTagStr = _free(dbiTagStr);
}
-/*@-redecl@*/
#define DB1vec NULL
#define DB2vec NULL
#ifdef HAVE_DB3_DB_H
-/*@-exportheadervar -declundef @*/
-/*@observer@*/ /*@unchecked@*/
extern struct _dbiVec db3vec;
-/*@=exportheadervar =declundef @*/
#define DB3vec &db3vec
-/*@=redecl@*/
#else
#define DB3vec NULL
#endif
#ifdef HAVE_SQLITE3_H
-/*@-exportheadervar -declundef @*/
-/*@observer@*/ /*@unchecked@*/
extern struct _dbiVec sqlitevec;
-/*@=exportheadervar =declundef @*/
#define SQLITEvec &sqlitevec
-/*@=redecl@*/
#else
#define SQLITEvec NULL
#endif
-/*@-nullassign@*/
-/*@observer@*/ /*@unchecked@*/
static struct _dbiVec *mydbvecs[] = {
DB1vec, DB1vec, DB2vec, DB3vec, SQLITEvec, NULL
};
-/*@=nullassign@*/
-dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, /*@unused@*/ unsigned int flags)
+dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, unsigned int flags)
{
int dbix;
dbiIndex dbi = NULL;
@@ -265,10 +219,9 @@ dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, /*@unused@*/ unsigned int flags)
return NULL;
/* Is this index already open ? */
-/*@-compdef@*/ /* FIX: db->_dbi may be NULL */
+/* FIX: db->_dbi may be NULL */
if ((dbi = db->_dbi[dbix]) != NULL)
return dbi;
-/*@=compdef@*/
_dbapi_rebuild = rpmExpandNumeric("%{_dbapi_rebuild}");
if (_dbapi_rebuild < 1 || _dbapi_rebuild > 4)
@@ -305,7 +258,7 @@ dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, /*@unused@*/ unsigned int flags)
dbi = NULL;
rc = (*mydbvecs[_dbapi]->open) (db, rpmtag, &dbi);
if (rc == 0 && dbi)
- /*@loopbreak@*/ break;
+ break;
}
if (_dbapi <= 0) {
static int _printed[32];
@@ -345,7 +298,6 @@ dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, /*@unused@*/ unsigned int flags)
exit:
if (dbi != NULL && rc == 0) {
db->_dbi[dbix] = dbi;
-/*@-sizeoftype@*/
if (rpmtag == RPMDBI_PACKAGES && db->db_bits == NULL) {
db->db_nbits = 1024;
if (!dbiStat(dbi, DB_FAST_STAT)) {
@@ -355,16 +307,14 @@ exit:
}
db->db_bits = PBM_ALLOC(db->db_nbits);
}
-/*@=sizeoftype@*/
}
#ifdef HAVE_DB3_DB_H
else
dbi = db3Free(dbi);
#endif
-/*@-compdef -nullstate@*/ /* FIX: db->_dbi may be NULL */
+/* FIX: db->_dbi may be NULL */
return dbi;
-/*@=compdef =nullstate@*/
}
/**
@@ -374,7 +324,6 @@ exit:
* @return new item
*/
static dbiIndexItem dbiIndexNewItem(unsigned int hdrNum, unsigned int tagNum)
- /*@*/
{
dbiIndexItem rec = xcalloc(1, sizeof(*rec));
rec->hdrNum = hdrNum;
@@ -388,11 +337,11 @@ union _dbswap {
};
#define _DBSWAP(_a) \
-/*@-bounds@*/ \
+\
{ unsigned char _b, *_c = (_a).uc; \
_b = _c[3]; _c[3] = _c[0]; _c[0] = _b; \
_b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \
-/*@=bounds@*/ \
+\
}
/**
@@ -402,8 +351,7 @@ union _dbswap {
* @retval setp (malloc'ed) index set
* @return 0 on success
*/
-static int dbt2set(dbiIndex dbi, DBT * data, /*@out@*/ dbiIndexSet * setp)
- /*@modifies dbi, *setp @*/
+static int dbt2set(dbiIndex dbi, DBT * data, dbiIndexSet * setp)
{
int _dbbyteswapped = dbiByteSwapped(dbi);
const char * sdbir;
@@ -422,7 +370,6 @@ static int dbt2set(dbiIndex dbi, DBT * data, /*@out@*/ dbiIndexSet * setp)
set->count = data->size / dbi->dbi_jlen;
set->recs = xmalloc(set->count * sizeof(*(set->recs)));
-/*@-bounds -sizeoftype @*/
switch (dbi->dbi_jlen) {
default:
case 2*sizeof(int_32):
@@ -458,10 +405,7 @@ static int dbt2set(dbiIndex dbi, DBT * data, /*@out@*/ dbiIndexSet * setp)
break;
}
*setp = set;
-/*@=bounds =sizeoftype @*/
-/*@-compdef@*/
return 0;
-/*@=compdef@*/
}
/**
@@ -472,7 +416,6 @@ static int dbt2set(dbiIndex dbi, DBT * data, /*@out@*/ dbiIndexSet * setp)
* @return 0 on success
*/
static int set2dbt(dbiIndex dbi, DBT * data, dbiIndexSet set)
- /*@modifies dbi, *data @*/
{
int _dbbyteswapped = dbiByteSwapped(dbi);
char * tdbir;
@@ -488,7 +431,6 @@ static int set2dbt(dbiIndex dbi, DBT * data, dbiIndexSet set)
}
tdbir = data->data = xmalloc(data->size);
-/*@-bounds -sizeoftype@*/
switch (dbi->dbi_jlen) {
default:
case 2*sizeof(int_32):
@@ -523,16 +465,12 @@ static int set2dbt(dbiIndex dbi, DBT * data, dbiIndexSet set)
}
break;
}
-/*@=bounds =sizeoftype@*/
-/*@-compdef@*/
return 0;
-/*@=compdef@*/
}
/* XXX assumes hdrNum is first int in dbiIndexItem */
static int hdrNumCmp(const void * one, const void * two)
- /*@*/
{
const int * a = one, * b = two;
return (*a - *b);
@@ -549,7 +487,6 @@ static int hdrNumCmp(const void * one, const void * two)
*/
static int dbiAppendSet(dbiIndexSet set, const void * recs,
int nrecs, size_t recsize, int sortset)
- /*@modifies *set @*/
{
const char * rptr = recs;
size_t rlen = (recsize < sizeof(*(set->recs)))
@@ -564,9 +501,7 @@ static int dbiAppendSet(dbiIndexSet set, const void * recs,
memset(set->recs + set->count, 0, nrecs * sizeof(*(set->recs)));
while (nrecs-- > 0) {
- /*@-mayaliasunique@*/
memcpy(set->recs + set->count, rptr, rlen);
- /*@=mayaliasunique@*/
rptr += recsize;
set->count++;
}
@@ -588,7 +523,6 @@ static int dbiAppendSet(dbiIndexSet set, const void * recs,
*/
static int dbiPruneSet(dbiIndexSet set, void * recs, int nrecs,
size_t recsize, int sorted)
- /*@modifies set, recs @*/
{
int from;
int to = 0;
@@ -639,10 +573,8 @@ dbiIndexSet dbiFreeIndexSet(dbiIndexSet set) {
typedef struct miRE_s {
rpmTag tag; /*!< header tag */
rpmMireMode mode; /*!< pattern match mode */
-/*@only@*/
const char * pattern; /*!< pattern string */
int notmatch; /*!< like "grep -v" */
-/*@only@*/
regex_t * preg; /*!< regex compiled pattern buffer */
int cflags; /*!< regcomp(3) flags */
int eflags; /*!< regexec(3) flags */
@@ -650,12 +582,9 @@ typedef struct miRE_s {
} * miRE;
struct _rpmdbMatchIterator {
-/*@dependent@*/ /*@null@*/
rpmdbMatchIterator mi_next;
-/*@only@*/
const void * mi_keyp;
size_t mi_keylen;
-/*@refcounted@*/
rpmdb mi_db;
rpmTag mi_rpmtag;
dbiIndexSet mi_set;
@@ -663,7 +592,6 @@ struct _rpmdbMatchIterator {
DBT mi_key;
DBT mi_data;
int mi_setx;
-/*@refcounted@*/ /*@null@*/
Header mi_h;
int mi_sorted;
int mi_cflags;
@@ -672,25 +600,17 @@ struct _rpmdbMatchIterator {
unsigned int mi_offset; /* header instance (native endian) */
unsigned int mi_filenum; /* tag element (native endian) */
int mi_nre;
-/*@only@*/ /*@null@*/
miRE mi_re;
-/*@null@*/
rpmts mi_ts;
-/*@null@*/
- rpmRC (*mi_hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg)
- /*@modifies ts, *msg @*/;
+ rpmRC (*mi_hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg);
};
-/*@unchecked@*/
static rpmdb rpmdbRock;
-/*@unchecked@*/ /*@exposed@*/ /*@null@*/
static rpmdbMatchIterator rpmmiRock;
int rpmdbCheckTerminate(int terminate)
- /*@globals rpmdbRock, rpmmiRock @*/
- /*@modifies rpmdbRock, rpmmiRock @*/
{
sigset_t newMask, oldMask;
static int terminating = 0;
@@ -712,21 +632,17 @@ int rpmdbCheckTerminate(int terminate)
rpmdb db;
rpmdbMatchIterator mi;
-/*@-branchstate@*/
while ((mi = rpmmiRock) != NULL) {
-/*@i@*/ rpmmiRock = mi->mi_next;
+ rpmmiRock = mi->mi_next;
mi->mi_next = NULL;
-/*@i@*/ mi = rpmdbFreeIterator(mi);
+ mi = rpmdbFreeIterator(mi);
}
-/*@=branchstate@*/
-/*@-newreftrans@*/
while ((db = rpmdbRock) != NULL) {
-/*@i@*/ rpmdbRock = db->db_next;
+ rpmdbRock = db->db_next;
db->db_next = NULL;
(void) rpmdbClose(db);
}
-/*@=newreftrans@*/
}
sigprocmask(SIG_SETMASK, &oldMask, NULL);
return terminating;
@@ -735,10 +651,9 @@ int rpmdbCheckTerminate(int terminate)
int rpmdbCheckSignals(void)
{
if (rpmdbCheckTerminate(0)) {
-/*@-abstract@*/ /* sigset_t is abstract type */
+/* sigset_t is abstract type */
rpmMessage(RPMMESS_DEBUG, "Exiting on signal(0x%lx) ...\n", *((unsigned long *)&rpmsqCaught));
exit(EXIT_FAILURE);
-/*@=abstract@*/
}
return 0;
}
@@ -746,9 +661,7 @@ int rpmdbCheckSignals(void)
/**
* Block all signals, returning previous signal mask.
*/
-static int blockSignals(/*@unused@*/ rpmdb db, /*@out@*/ sigset_t * oldMask)
- /*@globals fileSystem @*/
- /*@modifies *oldMask, fileSystem @*/
+static int blockSignals(rpmdb db, sigset_t * oldMask)
{
sigset_t newMask;
@@ -765,10 +678,7 @@ static int blockSignals(/*@unused@*/ rpmdb db, /*@out@*/ sigset_t * oldMask)
/**
* Restore signal mask.
*/
-/*@mayexit@*/
-static int unblockSignals(/*@unused@*/ rpmdb db, sigset_t * oldMask)
- /*@globals rpmdbRock, fileSystem, internalState @*/
- /*@modifies rpmdbRock, fileSystem, internalState @*/
+static int unblockSignals(rpmdb db, sigset_t * oldMask)
{
(void) rpmdbCheckSignals();
return sigprocmask(SIG_SETMASK, oldMask, NULL);
@@ -783,13 +693,10 @@ static int unblockSignals(/*@unused@*/ rpmdb db, sigset_t * oldMask)
#define _DB_MAJOR -1
#define _DB_ERRPFX "rpmdb"
-/*@-fullinitblock@*/
-/*@observer@*/ /*@unchecked@*/
static struct rpmdb_s dbTemplate = {
_DB_ROOT, _DB_HOME, _DB_FLAGS, _DB_MODE, _DB_PERMS,
_DB_MAJOR, _DB_ERRPFX
};
-/*@=fullinitblock@*/
static int isTemporaryDB(int rpmtag)
{
@@ -837,26 +744,20 @@ int rpmdbCloseDBI(rpmdb db, int rpmtag)
for (dbix = 0; dbix < dbiTagsMax; dbix++) {
if (dbiTags[dbix] != rpmtag)
continue;
-/*@-boundswrite@*/
if (db->_dbi[dbix] != NULL) {
int xx;
- /*@-unqualifiedtrans@*/ /* FIX: double indirection. */
+ /* FIX: double indirection. */
xx = dbiClose(db->_dbi[dbix], 0);
if (xx && rc == 0) rc = xx;
db->_dbi[dbix] = NULL;
- /*@=unqualifiedtrans@*/
}
-/*@=boundswrite@*/
break;
}
return rc;
}
/* XXX query.c, rpminstall.c, verify.c */
-/*@-incondefs@*/
int rpmdbClose(rpmdb db)
- /*@globals rpmdbRock @*/
- /*@modifies rpmdbRock @*/
{
rpmdb * prev, next;
int dbix;
@@ -867,7 +768,6 @@ int rpmdbClose(rpmdb db)
(void) rpmdbUnlink(db, "rpmdbClose");
- /*@-usereleased@*/
if (db->nrefs > 0)
goto exit;
@@ -876,11 +776,9 @@ int rpmdbClose(rpmdb db)
int xx;
if (db->_dbi[dbix] == NULL)
continue;
- /*@-unqualifiedtrans@*/ /* FIX: double indirection. */
xx = dbiClose(db->_dbi[dbix], 0);
if (xx && rc == 0) rc = xx;
db->_dbi[dbix] = NULL;
- /*@=unqualifiedtrans@*/
}
db->db_errpfx = _free(db->db_errpfx);
db->db_root = _free(db->db_root);
@@ -888,18 +786,15 @@ int rpmdbClose(rpmdb db)
db->db_bits = PBM_FREE(db->db_bits);
db->_dbi = _free(db->_dbi);
-/*@-newreftrans@*/
prev = &rpmdbRock;
while ((next = *prev) != NULL && next != db)
prev = &next->db_next;
if (next) {
-/*@i@*/ *prev = next->db_next;
+ *prev = next->db_next;
next->db_next = NULL;
}
-/*@=newreftrans@*/
- /*@-refcounttrans@*/ db = _free(db); /*@=refcounttrans@*/
- /*@=usereleased@*/
+ db = _free(db);
exit:
(void) rpmsqEnable(-SIGHUP, NULL);
@@ -909,7 +804,6 @@ exit:
(void) rpmsqEnable(-SIGPIPE,NULL);
return rc;
}
-/*@=incondefs@*/
int rpmdbSync(rpmdb db)
{
@@ -929,13 +823,11 @@ int rpmdbSync(rpmdb db)
return rc;
}
-/*@-mods@*/ /* FIX: dbTemplate structure assignment */
-static /*@only@*/ /*@null@*/
-rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root,
- /*@kept@*/ /*@null@*/ const char * home,
+/* FIX: dbTemplate structure assignment */
+static
+rpmdb newRpmdb(const char * root,
+ const char * home,
int mode, int perms, int flags)
- /*@globals _db_filter_dups, rpmGlobalMacroContext, h_errno @*/
- /*@modifies _db_filter_dups, rpmGlobalMacroContext @*/
{
rpmdb db = xcalloc(sizeof(*db), 1);
const char * epfx = _DB_ERRPFX;
@@ -946,11 +838,7 @@ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root,
_initialized = 1;
}
-/*@-boundswrite@*/
- /*@-assignexpose@*/
*db = dbTemplate; /* structure assignment */
- /*@=assignexpose@*/
-/*@=boundswrite@*/
db->_dbi = NULL;
@@ -960,7 +848,6 @@ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root,
if (perms >= 0) db->db_perms = perms;
if (flags >= 0) db->db_flags = flags;
-/*@-nullpass@*/
/* HACK: no URL's for root prefixed dbpath yet. */
if (root && *root) {
const char * rootpath = NULL;
@@ -982,13 +869,12 @@ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root,
} else
db->db_root = rpmGetPath(_DB_ROOT, NULL);
db->db_home = rpmGetPath( (home && *home ? home : _DB_HOME), NULL);
-/*@=nullpass@*/
if (!(db->db_home && db->db_home[0] != '%')) {
rpmError(RPMERR_DBOPEN, _("no dbpath has been set\n"));
db->db_root = _free(db->db_root);
db->db_home = _free(db->db_home);
db = _free(db);
- /*@-globstate@*/ return NULL; /*@=globstate@*/
+ return NULL;
}
db->db_errpfx = rpmExpand( (epfx && *epfx ? epfx : _DB_ERRPFX), NULL);
db->db_remove_env = 0;
@@ -996,21 +882,13 @@ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root,
db->db_ndbi = dbiTagsMax;
db->_dbi = xcalloc(db->db_ndbi, sizeof(*db->_dbi));
db->nrefs = 0;
- /*@-globstate@*/
return rpmdbLink(db, "rpmdbCreate");
- /*@=globstate@*/
}
-/*@=mods@*/
-static int openDatabase(/*@null@*/ const char * prefix,
- /*@null@*/ const char * dbpath,
- int _dbapi, /*@null@*/ /*@out@*/ rpmdb *dbp,
+static int openDatabase(const char * prefix,
+ const char * dbpath,
+ int _dbapi, rpmdb *dbp,
int mode, int perms, int flags)
- /*@globals rpmdbRock, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies rpmdbRock, *dbp, rpmGlobalMacroContext,
- fileSystem, internalState @*/
- /*@requires maxSet(dbp) >= 0 @*/
{
rpmdb db;
int rc, xx;
@@ -1072,14 +950,14 @@ static int openDatabase(/*@null@*/ const char * prefix,
if (db->db_api == 3)
#endif
goto exit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPMTAG_NAME:
if (dbi == NULL) rc |= 1;
if (minimal)
goto exit;
- /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
}
}
@@ -1088,11 +966,9 @@ exit:
if (rc || justCheck || dbp == NULL)
xx = rpmdbClose(db);
else {
-/*@-assignexpose -newreftrans@*/
-/*@i@*/ db->db_next = rpmdbRock;
+ db->db_next = rpmdbRock;
rpmdbRock = db;
-/*@i@*/ *dbp = db;
-/*@=assignexpose =newreftrans@*/
+ *dbp = db;
}
return rc;
@@ -1100,10 +976,8 @@ exit:
rpmdb XrpmdbUnlink(rpmdb db, const char * msg, const char * fn, unsigned ln)
{
-/*@-modfilesys@*/
if (_rpmdb_debug)
fprintf(stderr, "--> db %p -- %d %s at %s:%u\n", db, db->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
db->nrefs--;
return NULL;
}
@@ -1111,20 +985,16 @@ fprintf(stderr, "--> db %p -- %d %s at %s:%u\n", db, db->nrefs, msg, fn, ln);
rpmdb XrpmdbLink(rpmdb db, const char * msg, const char * fn, unsigned ln)
{
db->nrefs++;
-/*@-modfilesys@*/
if (_rpmdb_debug)
fprintf(stderr, "--> db %p ++ %d %s at %s:%u\n", db, db->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
- /*@-refcounttrans@*/ return db; /*@=refcounttrans@*/
+ return db;
}
/* XXX python/rpmmodule.c */
int rpmdbOpen (const char * prefix, rpmdb *dbp, int mode, int perms)
{
int _dbapi = rpmExpandNumeric("%{_dbapi}");
-/*@-boundswrite@*/
return openDatabase(prefix, NULL, _dbapi, dbp, mode, perms, 0);
-/*@=boundswrite@*/
}
int rpmdbInit (const char * prefix, int perms)
@@ -1133,10 +1003,8 @@ int rpmdbInit (const char * prefix, int perms)
int _dbapi = rpmExpandNumeric("%{_dbapi}");
int rc;
-/*@-boundswrite@*/
rc = openDatabase(prefix, NULL, _dbapi, &db, (O_CREAT | O_RDWR),
perms, RPMDB_FLAG_JUSTCHECK);
-/*@=boundswrite@*/
if (db != NULL) {
int xx;
xx = rpmdbOpenAll(db);
@@ -1154,9 +1022,7 @@ int rpmdbVerify(const char * prefix)
int _dbapi = rpmExpandNumeric("%{_dbapi}");
int rc = 0;
-/*@-boundswrite@*/
rc = openDatabase(prefix, NULL, _dbapi, &db, O_RDONLY, 0644, 0);
-/*@=boundswrite@*/
if (db != NULL) {
int dbix;
@@ -1166,16 +1032,14 @@ int rpmdbVerify(const char * prefix)
for (dbix = db->db_ndbi; --dbix >= 0; ) {
if (db->_dbi[dbix] == NULL)
continue;
- /*@-unqualifiedtrans@*/ /* FIX: double indirection. */
+ /* FIX: double indirection. */
xx = dbiVerify(db->_dbi[dbix], 0);
if (xx && rc == 0) rc = xx;
db->_dbi[dbix] = NULL;
- /*@=unqualifiedtrans@*/
}
- /*@-nullstate@*/ /* FIX: db->_dbi[] may be NULL. */
+ /* FIX: db->_dbi[] may be NULL. */
xx = rpmdbClose(db);
- /*@=nullstate@*/
if (xx && rc == 0) rc = xx;
db = NULL;
}
@@ -1191,12 +1055,8 @@ int rpmdbVerify(const char * prefix)
* @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 rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, *key, *data, *matches, rpmGlobalMacroContext,
- fileSystem, internalState @*/
- /*@requires maxSet(matches) >= 0 @*/
+static int rpmdbFindByFile(rpmdb db, const char * filespec,
+ DBT * key, DBT * data, dbiIndexSet * matches)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
@@ -1216,23 +1076,19 @@ static int rpmdbFindByFile(rpmdb db, /*@null@*/ const char * filespec,
*matches = NULL;
if (filespec == NULL) return -2;
- /*@-branchstate@*/
if ((baseName = strrchr(filespec, '/')) != NULL) {
char * t;
size_t len;
len = baseName - filespec + 1;
-/*@-boundswrite@*/
t = strncpy(alloca(len + 1), filespec, len);
t[len] = '\0';
-/*@=boundswrite@*/
dirName = t;
baseName++;
} else {
dirName = "";
baseName = filespec;
}
- /*@=branchstate@*/
if (baseName == NULL)
return -2;
@@ -1240,14 +1096,11 @@ static int rpmdbFindByFile(rpmdb db, /*@null@*/ const char * filespec,
fp1 = fpLookup(fpc, dirName, baseName, 1);
dbi = dbiOpen(db, RPMTAG_BASENAMES, 0);
-/*@-branchstate@*/
if (dbi != NULL) {
dbcursor = NULL;
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0);
-/*@-temptrans@*/
key->data = (void *) baseName;
-/*@=temptrans@*/
key->size = strlen(baseName);
if (key->size == 0) key->size++; /* XXX "/" fixup. */
@@ -1265,7 +1118,6 @@ if (rc == 0)
dbcursor = NULL;
} else
rc = -2;
-/*@=branchstate@*/
if (rc) {
allMatches = dbiFreeIndexSet(allMatches);
@@ -1306,9 +1158,7 @@ if (rc == 0)
int num = dbiIndexRecordFileNumber(allMatches, i);
fp2 = fpLookup(fpc, dirNames[dirIndexes[num]], baseNames[num], 1);
- /*@-nullpass@*/
if (FP_EQUAL(fp1, fp2)) {
- /*@=nullpass@*/
rec->hdrNum = dbiIndexRecordOffset(allMatches, i);
rec->tagNum = dbiIndexRecordFileNumber(allMatches, i);
xx = dbiAppendSet(*matches, rec, 1, sizeof(*rec), 0);
@@ -1358,9 +1208,7 @@ memset(data, 0, sizeof(*data));
if (dbi == NULL)
return 0;
-/*@-temptrans@*/
key->data = (void *) name;
-/*@=temptrans@*/
key->size = strlen(name);
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0);
@@ -1372,14 +1220,13 @@ key->size = strlen(name);
if (rc == 0) { /* success */
dbiIndexSet matches;
- /*@-nullpass@*/ /* FIX: matches might be NULL */
+ /* FIX: matches might be NULL */
matches = NULL;
(void) dbt2set(dbi, data, &matches);
if (matches) {
rc = dbiIndexSetCount(matches);
matches = dbiFreeIndexSet(matches);
}
- /*@=nullpass@*/
} else
if (rc == DB_NOTFOUND) { /* not found */
rc = 0;
@@ -1413,21 +1260,15 @@ key->size = strlen(name);
static rpmRC dbiFindMatches(dbiIndex dbi, DBC * dbcursor,
DBT * key, DBT * data,
const char * name,
- /*@null@*/ const char * version,
- /*@null@*/ const char * release,
- /*@out@*/ dbiIndexSet * matches)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, *key, *data, *matches,
- rpmGlobalMacroContext, fileSystem, internalState @*/
- /*@requires maxSet(matches) >= 0 @*/
+ const char * version,
+ const char * release,
+ dbiIndexSet * matches)
{
int gotMatches = 0;
int rc;
int i;
-/*@-temptrans@*/
key->data = (void *) name;
-/*@=temptrans@*/
key->size = strlen(name);
rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
@@ -1447,7 +1288,6 @@ key->size = strlen(name);
}
/* Make sure the version and release match. */
- /*@-branchstate@*/
for (i = 0; i < dbiIndexSetCount(*matches); i++) {
unsigned int recoff = dbiIndexRecordOffset(*matches, i);
rpmdbMatchIterator mi;
@@ -1474,15 +1314,12 @@ key->size = strlen(name);
}
h = rpmdbNextIterator(mi);
-/*@-boundswrite@*/
if (h)
(*matches)->recs[gotMatches++] = (*matches)->recs[i];
else
(*matches)->recs[i].hdrNum = 0;
-/*@=boundswrite@*/
mi = rpmdbFreeIterator(mi);
}
- /*@=branchstate@*/
if (gotMatches) {
(*matches)->count = gotMatches;
@@ -1491,10 +1328,9 @@ key->size = strlen(name);
rc = RPMRC_NOTFOUND;
exit:
-/*@-unqualifiedtrans@*/ /* FIX: double indirection */
+/* FIX: double indirection */
if (rc && matches && *matches)
*matches = dbiFreeIndexSet(*matches);
-/*@=unqualifiedtrans@*/
return rc;
}
@@ -1511,11 +1347,7 @@ exit:
* @return RPMRC_OK on match, RPMRC_NOMATCH or RPMRC_FAIL
*/
static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
- /*@null@*/ const char * arg, /*@out@*/ dbiIndexSet * matches)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, *key, *data, *matches,
- rpmGlobalMacroContext, fileSystem, internalState @*/
- /*@requires maxSet(matches) >= 0 @*/
+ const char * arg, dbiIndexSet * matches)
{
const char * release;
char * localarg;
@@ -1530,9 +1362,8 @@ 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;
- /*@-unqualifiedtrans@*/ /* FIX: double indirection */
+ /* FIX: double indirection */
*matches = dbiFreeIndexSet(*matches);
- /*@=unqualifiedtrans@*/
/* maybe a name and a release */
localarg = alloca(strlen(arg) + 1);
@@ -1544,29 +1375,25 @@ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
switch (*s) {
case '[':
brackets = 1;
- /*@switchbreak@*/ break;
+ break;
case ']':
if (c != '[') brackets = 0;
- /*@switchbreak@*/ break;
+ break;
}
c = *s;
if (!brackets && *s == '-')
break;
}
- /*@-nullstate@*/ /* FIX: *matches may be NULL. */
+ /* FIX: *matches may be NULL. */
if (s == localarg) return RPMRC_NOTFOUND;
-/*@-boundswrite@*/
*s = '\0';
-/*@=boundswrite@*/
rc = dbiFindMatches(dbi, dbcursor, key, data, localarg, s + 1, NULL, matches);
- /*@=nullstate@*/
if (rc != RPMRC_NOTFOUND) return rc;
- /*@-unqualifiedtrans@*/ /* FIX: double indirection */
+ /* FIX: double indirection */
*matches = dbiFreeIndexSet(*matches);
- /*@=unqualifiedtrans@*/
/* how about name-version-release? */
@@ -1578,10 +1405,10 @@ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
switch (*s) {
case '[':
brackets = 1;
- /*@switchbreak@*/ break;
+ break;
case ']':
if (c != '[') brackets = 0;
- /*@switchbreak@*/ break;
+ break;
}
c = *s;
if (!brackets && *s == '-')
@@ -1590,12 +1417,9 @@ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
if (s == localarg) return RPMRC_NOTFOUND;
-/*@-boundswrite@*/
*s = '\0';
-/*@=boundswrite@*/
- /*@-nullstate@*/ /* FIX: *matches may be NULL. */
+ /* FIX: *matches may be NULL. */
return dbiFindMatches(dbi, dbcursor, key, data, localarg, s + 1, release, matches);
- /*@=nullstate@*/
}
/**
@@ -1607,8 +1431,6 @@ static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
* @return 0 on success
*/
static int miFreeHeader(rpmdbMatchIterator mi, dbiIndex dbi)
- /*@globals fileSystem, internalState @*/
- /*@modifies mi, dbi, fileSystem, internalState @*/
{
int rc = 0;
@@ -1622,7 +1444,7 @@ static int miFreeHeader(rpmdbMatchIterator mi, dbiIndex dbi)
rpmRC rpmrc = RPMRC_NOTFOUND;
int xx;
-/*@i@*/ key->data = (void *) &mi->mi_prevoffset;
+ key->data = (void *) &mi->mi_prevoffset;
key->size = sizeof(mi->mi_prevoffset);
data->data = headerUnload(mi->mi_h);
data->size = headerSizeof(mi->mi_h, HEADER_MAGIC_NO);
@@ -1657,14 +1479,10 @@ static int miFreeHeader(rpmdbMatchIterator mi, dbiIndex dbi)
mi->mi_h = headerFree(mi->mi_h);
-/*@-nullstate@*/
return rc;
-/*@=nullstate@*/
}
rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
- /*@globals rpmmiRock @*/
- /*@modifies rpmmiRock @*/
{
rpmdbMatchIterator * prev, next;
dbiIndex dbi;
@@ -1678,7 +1496,7 @@ rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
while ((next = *prev) != NULL && next != mi)
prev = &next->mi_next;
if (next) {
-/*@i@*/ *prev = next->mi_next;
+ *prev = next->mi_next;
next->mi_next = NULL;
}
@@ -1698,9 +1516,8 @@ rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
mire->pattern = _free(mire->pattern);
if (mire->preg != NULL) {
regfree(mire->preg);
- /*@+voidabstract -usereleased @*/ /* LCL: regfree has bogus only */
+ /* LCL: regfree has bogus only */
mire->preg = _free(mire->preg);
- /*@=voidabstract =usereleased @*/
}
}
mi->mi_re = _free(mi->mi_re);
@@ -1735,7 +1552,6 @@ int rpmdbGetIteratorCount(rpmdbMatchIterator mi) {
* @return 0 if pattern matches, >0 on nomatch, <0 on error
*/
static int miregexec(miRE mire, const char * val)
- /*@*/
{
int rc = 0;
@@ -1746,9 +1562,7 @@ static int miregexec(miRE mire, const char * val)
break;
case RPMMIRE_DEFAULT:
case RPMMIRE_REGEX:
-/*@-boundswrite@*/
rc = regexec(mire->preg, val, 0, NULL, mire->eflags);
-/*@=boundswrite@*/
if (rc && rc != REG_NOMATCH) {
char msg[256];
(void) regerror(rc, mire->preg, msg, sizeof(msg)-1);
@@ -1791,10 +1605,8 @@ static int mireCmp(const void * a, const void * b)
* @param pattern pattern to duplicate
* @return duplicated pattern
*/
-static /*@only@*/ char * mireDup(rpmTag tag, rpmMireMode *modep,
+static char * mireDup(rpmTag tag, rpmMireMode *modep,
const char * pattern)
- /*@modifies *modep @*/
- /*@requires maxSet(modep) >= 0 @*/
{
const char * s;
char * pat;
@@ -1803,7 +1615,6 @@ static /*@only@*/ char * mireDup(rpmTag tag, rpmMireMode *modep,
size_t nb;
int c;
-/*@-boundswrite@*/
switch (*modep) {
default:
case RPMMIRE_DEFAULT:
@@ -1825,16 +1636,16 @@ static /*@only@*/ char * mireDup(rpmTag tag, rpmMireMode *modep,
case '+':
case '*':
if (!brackets) nb++;
- /*@switchbreak@*/ break;
+ break;
case '\\':
s++;
- /*@switchbreak@*/ break;
+ break;
case '[':
brackets = 1;
- /*@switchbreak@*/ break;
+ break;
case ']':
if (c != '[') brackets = 0;
- /*@switchbreak@*/ break;
+ break;
}
c = *s;
}
@@ -1851,19 +1662,19 @@ static /*@only@*/ char * mireDup(rpmTag tag, rpmMireMode *modep,
case '.':
case '+':
if (!brackets) *t++ = '\\';
- /*@switchbreak@*/ break;
+ break;
case '*':
if (!brackets) *t++ = '.';
- /*@switchbreak@*/ break;
+ break;
case '\\':
*t++ = *s++;
- /*@switchbreak@*/ break;
+ break;
case '[':
brackets = 1;
- /*@switchbreak@*/ break;
+ break;
case ']':
if (c != '[') brackets = 0;
- /*@switchbreak@*/ break;
+ break;
}
c = *t = *s;
}
@@ -1878,7 +1689,6 @@ static /*@only@*/ char * mireDup(rpmTag tag, rpmMireMode *modep,
pat = xstrdup(pattern);
break;
}
-/*@-boundswrite@*/
return pat;
}
@@ -1896,7 +1706,6 @@ int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
int fnflags = 0;
int rc = 0;
-/*@-boundsread@*/
if (defmode == (rpmMireMode)-1) {
const char *t = rpmExpand("%{?_query_selector_match}", NULL);
@@ -1921,24 +1730,18 @@ int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
notmatch = 1;
pattern++;
}
-/*@=boundsread@*/
-/*@-boundswrite@*/
allpat = mireDup(tag, &mode, pattern);
-/*@=boundswrite@*/
if (mode == RPMMIRE_DEFAULT)
mode = defmode;
- /*@-branchstate@*/
switch (mode) {
case RPMMIRE_DEFAULT:
case RPMMIRE_STRCMP:
break;
case RPMMIRE_REGEX:
- /*@-type@*/
preg = xcalloc(1, sizeof(*preg));
- /*@=type@*/
cflags = (REG_EXTENDED | REG_NOSUB);
rc = regcomp(preg, allpat, cflags);
if (rc) {
@@ -1955,18 +1758,15 @@ int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
rc = -1;
break;
}
- /*@=branchstate@*/
if (rc) {
- /*@=kepttrans@*/ /* FIX: mire has kept values */
+ /* FIX: mire has kept values */
allpat = _free(allpat);
if (preg) {
regfree(preg);
- /*@+voidabstract -usereleased @*/ /* LCL: regfree has bogus only */
+ /* LCL: regfree has bogus only */
preg = _free(preg);
- /*@=voidabstract =usereleased @*/
}
- /*@=kepttrans@*/
return rc;
}
@@ -1983,10 +1783,8 @@ int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
mire->eflags = eflags;
mire->fnflags = fnflags;
-/*@-boundsread@*/
if (mi->mi_nre > 1)
qsort(mi->mi_re, mi->mi_nre, sizeof(*mi->mi_re), mireCmp);
-/*@=boundsread@*/
return rc;
}
@@ -1997,7 +1795,6 @@ int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
* @return 1 if header should be skipped
*/
static int mireSkip (const rpmdbMatchIterator mi)
- /*@*/
{
HGE_t hge = (HGE_t) headerGetEntryMinMemory;
HFD_t hfd = (HFD_t) headerFreeData;
@@ -2026,7 +1823,6 @@ static int mireSkip (const rpmdbMatchIterator mi)
* Apply tag tests, implicitly "||" for multiple patterns/values of a
* single tag, implicitly "&&" between multiple tag patterns.
*/
-/*@-boundsread@*/
if ((mire = mi->mi_re) != NULL)
for (i = 0; i < mi->mi_nre; i++, mire++) {
int anymatch;
@@ -2037,9 +1833,7 @@ static int mireSkip (const rpmdbMatchIterator mi)
continue;
}
t = RPM_INT32_TYPE;
-/*@-immediatetrans@*/
u.i32p = &zero;
-/*@=immediatetrans@*/
c = 1;
}
@@ -2052,34 +1846,34 @@ static int mireSkip (const rpmdbMatchIterator mi)
rc = miregexec(mire, numbuf);
if ((!rc && !mire->notmatch) || (rc && mire->notmatch))
anymatch++;
- /*@switchbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
sprintf(numbuf, "%d", (int) *u.i16p);
rc = miregexec(mire, numbuf);
if ((!rc && !mire->notmatch) || (rc && mire->notmatch))
anymatch++;
- /*@switchbreak@*/ break;
+ break;
case RPM_INT32_TYPE:
sprintf(numbuf, "%d", (int) *u.i32p);
rc = miregexec(mire, numbuf);
if ((!rc && !mire->notmatch) || (rc && mire->notmatch))
anymatch++;
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
rc = miregexec(mire, u.str);
if ((!rc && !mire->notmatch) || (rc && mire->notmatch))
anymatch++;
- /*@switchbreak@*/ break;
+ break;
case RPM_I18NSTRING_TYPE:
case RPM_STRING_ARRAY_TYPE:
for (j = 0; j < c; j++) {
rc = miregexec(mire, u.argv[j]);
if ((!rc && !mire->notmatch) || (rc && mire->notmatch)) {
anymatch++;
- /*@innerbreak@*/ break;
+ break;
}
}
- /*@switchbreak@*/ break;
+ break;
case RPM_BIN_TYPE:
{
const char * str = bin2hex((const char*) u.ptr, c);
@@ -2088,19 +1882,18 @@ static int mireSkip (const rpmdbMatchIterator mi)
anymatch++;
_free(str);
}
- /*@switchbreak@*/ break;
+ break;
case RPM_NULL_TYPE:
default:
- /*@switchbreak@*/ break;
+ break;
}
if ((i+1) < mi->mi_nre && mire[0].tag == mire[1].tag) {
i++;
mire++;
- /*@innercontinue@*/ continue;
+ continue;
}
- /*@innerbreak@*/ break;
+ break;
}
-/*@=boundsread@*/
if ((tagType(mire->tag) & RPM_MASK_RETURN_TYPE) ==
RPM_ARRAY_RETURN_TYPE) {
@@ -2144,15 +1937,14 @@ int rpmdbSetHdrChk(rpmdbMatchIterator mi, rpmts ts,
int rc = 0;
if (mi == NULL)
return 0;
-/*@-assignexpose -newreftrans @*/ /* XXX forward linkage prevents rpmtsLink */
-/*@i@*/ mi->mi_ts = ts;
+/* XXX forward linkage prevents rpmtsLink */
+mi->mi_ts = ts;
mi->mi_hdrchk = hdrchk;
-/*@=assignexpose =newreftrans @*/
return rc;
}
-/*@-nullstate@*/ /* FIX: mi->mi_key.data may be NULL */
+/* FIX: mi->mi_key.data may be NULL */
Header rpmdbNextIterator(rpmdbMatchIterator mi)
{
dbiIndex dbi;
@@ -2181,12 +1973,10 @@ Header rpmdbNextIterator(rpmdbMatchIterator mi)
if (mi->mi_dbc == NULL)
xx = dbiCopen(dbi, dbi->dbi_txnid, &mi->mi_dbc, mi->mi_cflags);
-/*@-boundswrite@*/
key = &mi->mi_key;
memset(key, 0, sizeof(*key));
data = &mi->mi_data;
memset(data, 0, sizeof(*data));
-/*@=boundswrite@*/
top:
uh = NULL;
@@ -2195,7 +1985,6 @@ top:
do {
union _dbswap mi_offset;
- /*@-branchstate -compmempass @*/
if (mi->mi_set) {
if (!(mi->mi_setx < mi->mi_set->count))
return NULL;
@@ -2230,31 +2019,25 @@ if (dbiByteSwapped(dbi) == 1)
* largest header instance in the database, and should be
* skipped.
*/
-/*@-boundswrite@*/
if (keyp && mi->mi_setx && rc == 0) {
memcpy(&mi_offset, keyp, sizeof(mi_offset.ui));
if (dbiByteSwapped(dbi) == 1)
_DBSWAP(mi_offset);
mi->mi_offset = mi_offset.ui;
}
-/*@=boundswrite@*/
/* Terminate on error or end of keys */
if (rc || (mi->mi_setx && mi->mi_offset == 0))
return NULL;
}
- /*@=branchstate =compmempass @*/
mi->mi_setx++;
} while (mi->mi_offset == 0);
/* If next header is identical, return it now. */
-/*@-compdef -refcounttrans -retalias -retexpose -usereleased @*/
if (mi->mi_prevoffset && mi->mi_offset == mi->mi_prevoffset)
return mi->mi_h;
-/*@=compdef =refcounttrans =retalias =retexpose =usereleased @*/
/* Retrieve next header blob for index iterator. */
- /*@-branchstate -compmempass -immediatetrans @*/
if (uh == NULL) {
key->data = keyp;
key->size = keylen;
@@ -2270,7 +2053,6 @@ if (dbiByteSwapped(dbi) == 1)
if (rc)
return NULL;
}
- /*@=branchstate =compmempass =immediatetrans @*/
/* Rewrite current header (if necessary) and unlink. */
xx = miFreeHeader(mi, dbi);
@@ -2280,7 +2062,6 @@ if (dbiByteSwapped(dbi) == 1)
return NULL;
/* Check header digest/signature once (if requested). */
-/*@-boundsread -branchstate -sizeoftype @*/
if (mi->mi_hdrchk && mi->mi_ts) {
rpmRC rpmrc = RPMRC_NOTFOUND;
@@ -2320,13 +2101,10 @@ if (dbiByteSwapped(dbi) == 1)
goto top;
}
}
-/*@=boundsread =branchstate =sizeoftype @*/
/* Did the header blob load correctly? */
#if !defined(_USE_COPY_LOAD)
-/*@-onlytrans@*/
mi->mi_h = headerLoad(uh);
-/*@=onlytrans@*/
if (mi->mi_h)
mi->mi_h->flags |= HEADERFLAG_ALLOCATED;
#else
@@ -2352,14 +2130,10 @@ if (dbiByteSwapped(dbi) == 1)
mi->mi_prevoffset = mi->mi_offset;
mi->mi_modified = 0;
-/*@-compdef -retalias -retexpose -usereleased @*/
return mi->mi_h;
-/*@=compdef =retalias =retexpose =usereleased @*/
}
-/*@=nullstate@*/
-static void rpmdbSortIterator(/*@null@*/ rpmdbMatchIterator mi)
- /*@modifies mi @*/
+static void rpmdbSortIterator(rpmdbMatchIterator mi)
{
if (mi && mi->mi_set && mi->mi_set->recs && mi->mi_set->count > 0) {
/*
@@ -2367,10 +2141,8 @@ static void rpmdbSortIterator(/*@null@*/ rpmdbMatchIterator mi)
* than pure quicksort, but glibc uses msort_with_tmp() on stack.
*/
#if defined(__GLIBC__)
-/*@-boundsread@*/
qsort(mi->mi_set->recs, mi->mi_set->count,
sizeof(*mi->mi_set->recs), hdrNumCmp);
-/*@=boundsread@*/
#else
mergesort(mi->mi_set->recs, mi->mi_set->count,
sizeof(*mi->mi_set->recs), hdrNumCmp);
@@ -2379,10 +2151,8 @@ static void rpmdbSortIterator(/*@null@*/ rpmdbMatchIterator mi)
}
}
-/*@-bounds@*/ /* LCL: segfault */
-static int rpmdbGrowIterator(/*@null@*/ rpmdbMatchIterator mi, int fpNum)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/
+/* LCL: segfault */
+static int rpmdbGrowIterator(rpmdbMatchIterator mi, int fpNum)
{
DBC * dbcursor;
DBT * key;
@@ -2435,7 +2205,6 @@ static int rpmdbGrowIterator(/*@null@*/ rpmdbMatchIterator mi, int fpNum)
dbcursor = NULL;
#endif
-/*@-branchstate@*/
if (mi->mi_set == NULL) {
mi->mi_set = set;
} else {
@@ -2449,11 +2218,9 @@ fprintf(stderr, "+++ %d = %d + %d\t\"%s\"\n", (mi->mi_set->count + set->count),
mi->mi_set->count += set->count;
set = dbiFreeIndexSet(set);
}
-/*@=branchstate@*/
return rc;
}
-/*@=bounds@*/
int rpmdbPruneIterator(rpmdbMatchIterator mi, int * hdrNums,
int nHdrNums, int sorted)
@@ -2479,8 +2246,6 @@ int rpmdbAppendIterator(rpmdbMatchIterator mi, const int * hdrNums, int nHdrNums
rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag,
const void * keyp, size_t keylen)
- /*@globals rpmmiRock @*/
- /*@modifies rpmmiRock @*/
{
rpmdbMatchIterator mi;
DBT * key;
@@ -2517,7 +2282,6 @@ rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag,
* Handle label and file name special cases.
* Otherwise, retrieve join keys for secondary lookup.
*/
-/*@-branchstate@*/
if (rpmtag != RPMDBI_PACKAGES && keyp) {
DBC * dbcursor = NULL;
int rc;
@@ -2533,16 +2297,12 @@ rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag,
} else {
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0);
-/*@-temptrans@*/
key->data = (void *) keyp;
-/*@=temptrans@*/
key->size = keylen;
if (key->data && key->size == 0) key->size = strlen((char *)key->data);
if (key->data && key->size == 0) key->size++; /* XXX "/" fixup. */
-/*@-nullstate@*/
rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
-/*@=nullstate@*/
if (rc > 0) {
rpmError(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"),
@@ -2564,7 +2324,6 @@ if (key->data && key->size == 0) key->size++; /* XXX "/" fixup. */
return NULL;
}
}
-/*@=branchstate@*/
/* Copy the retrieval key, byte swapping header instance if necessary. */
if (keyp) {
@@ -2584,9 +2343,7 @@ assert(keylen == sizeof(k->ui)); /* xxx programmer error */
if (keylen == 0)
keylen = strlen(keyp);
k = xmalloc(keylen + 1);
-/*@-boundsread@*/
memcpy(k, keyp, keylen);
-/*@=boundsread@*/
k[keylen] = '\0'; /* XXX assumes strings */
mi_keyp = k;
} break;
@@ -2615,13 +2372,13 @@ assert(keylen == sizeof(k->ui)); /* xxx programmer error */
mi->mi_ts = NULL;
mi->mi_hdrchk = NULL;
-/*@i@*/ return mi;
+return mi;
}
/* XXX psm.c */
-int rpmdbRemove(rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
- /*@unused@*/ rpmts ts,
- /*@unused@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
+int rpmdbRemove(rpmdb db, int rid, unsigned int hdrNum,
+ rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
{
DBC * dbcursor = NULL;
DBT * key = alloca(sizeof(*key));
@@ -2669,7 +2426,7 @@ memset(data, 0, sizeof(*data));
(void) blockSignals(db, &signalMask);
- /*@-nullpass -nullptrarith -nullderef @*/ /* FIX: rpmvals heartburn */
+ /* FIX: rpmvals heartburn */
{ int dbix;
dbiIndexItem rec = dbiIndexNewItem(hdrNum, 0);
@@ -2685,11 +2442,8 @@ memset(data, 0, sizeof(*data));
int i, j;
dbi = NULL;
-/*@-boundsread@*/
rpmtag = dbiTags[dbix];
-/*@=boundsread@*/
- /*@-branchstate@*/
/* Filter out temporary databases */
if (isTemporaryDB(rpmtag))
continue;
@@ -2700,12 +2454,10 @@ memset(data, 0, sizeof(*data));
if (dbi == NULL) /* XXX shouldn't happen */
continue;
-/*@-immediatetrans@*/
mi_offset.ui = hdrNum;
if (dbiByteSwapped(dbi) == 1)
_DBSWAP(mi_offset);
key->data = &mi_offset;
-/*@=immediatetrans@*/
key->size = sizeof(mi_offset.ui);
rc = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, DB_WRITECURSOR);
@@ -2721,9 +2473,8 @@ if (dbiByteSwapped(dbi) == 1)
if (!dbi->dbi_no_dbsync)
xx = dbiSync(dbi, 0);
continue;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
}
- /*@=branchstate@*/
if (!hge(h, rpmtag, &rpmtype, (void **) &rpmvals, &rpmcnt))
continue;
@@ -2741,7 +2492,6 @@ if (dbiByteSwapped(dbi) == 1)
printed = 0;
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, DB_WRITECURSOR);
-/*@-branchstate@*/
for (i = 0; i < rpmcnt; i++) {
dbiIndexSet set;
int stringvalued;
@@ -2751,42 +2501,38 @@ if (dbiByteSwapped(dbi) == 1)
case RPMTAG_FILEMD5S:
/* Filter out empty MD5 strings. */
if (!(rpmvals[i] && *rpmvals[i] != '\0'))
- /*@innercontinue@*/ continue;
- /*@switchbreak@*/ break;
+ continue;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
/* Identify value pointer and length. */
stringvalued = 0;
switch (rpmtype) {
-/*@-sizeoftype@*/
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
key->size = sizeof(RPM_CHAR_TYPE);
key->data = rpmvals + i;
- /*@switchbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
key->size = sizeof(int_16);
key->data = rpmvals + i;
- /*@switchbreak@*/ break;
+ break;
case RPM_INT32_TYPE:
key->size = sizeof(int_32);
key->data = rpmvals + i;
- /*@switchbreak@*/ break;
-/*@=sizeoftype@*/
+ break;
case RPM_BIN_TYPE:
key->size = rpmcnt;
key->data = rpmvals;
rpmcnt = 1; /* XXX break out of loop. */
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
case RPM_I18NSTRING_TYPE:
rpmcnt = 1; /* XXX break out of loop. */
- /*@fallthrough@*/
case RPM_STRING_ARRAY_TYPE:
/* Convert from hex to binary. */
-/*@-boundsread@*/
if (dbi->dbi_rpmtag == RPMTAG_FILEMD5S) {
const char * s;
byte * t;
@@ -2797,7 +2543,7 @@ if (dbiByteSwapped(dbi) == 1)
*t = (nibble(s[0]) << 4) | nibble(s[1]);
key->data = bin;
key->size = 16;
- /*@switchbreak@*/ break;
+ break;
}
/* Extract the pubkey id from the base64 blob. */
if (dbi->dbi_rpmtag == RPMTAG_PUBKEYS) {
@@ -2806,22 +2552,20 @@ if (dbiByteSwapped(dbi) == 1)
size_t pktlen;
if (b64decode(rpmvals[i], (void **)&pkt, &pktlen))
- /*@innercontinue@*/ continue;
+ continue;
(void) pgpPrtPkts(pkt, pktlen, dig, 0);
memcpy(bin, dig->pubkey.signid, 8);
pkt = _free(pkt);
dig = _free(dig);
key->data = bin;
key->size = 8;
- /*@switchbreak@*/ break;
+ break;
}
-/*@=boundsread@*/
- /*@fallthrough@*/
default:
-/*@i@*/ key->data = (void *) rpmvals[i];
+ key->data = (void *) rpmvals[i];
key->size = strlen(rpmvals[i]);
stringvalued = 1;
- /*@switchbreak@*/ break;
+ break;
}
if (!printed) {
@@ -2851,30 +2595,27 @@ if (dbiByteSwapped(dbi) == 1)
if (key->size == 0) key->size = strlen((char *)key->data);
if (key->size == 0) key->size++; /* XXX "/" fixup. */
-/*@-compmempass@*/
rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
if (rc == 0) { /* success */
(void) dbt2set(dbi, data, &set);
} else if (rc == DB_NOTFOUND) { /* not found */
- /*@innercontinue@*/ continue;
+ continue;
} else { /* error */
rpmError(RPMERR_DBGETINDEX,
_("error(%d) setting \"%s\" records from %s index\n"),
rc, key->data, tagName(dbi->dbi_rpmtag));
ret += 1;
- /*@innercontinue@*/ continue;
+ continue;
}
-/*@=compmempass@*/
rc = dbiPruneSet(set, rec, 1, sizeof(*rec), 1);
/* If nothing was pruned, then don't bother updating. */
if (rc) {
set = dbiFreeIndexSet(set);
- /*@innercontinue@*/ continue;
+ continue;
}
-/*@-compmempass@*/
if (set->count > 0) {
(void) set2dbt(dbi, data, set);
rc = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST);
@@ -2895,10 +2636,8 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
ret += 1;
}
}
-/*@=compmempass@*/
set = dbiFreeIndexSet(set);
}
-/*@=branchstate@*/
xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR);
dbcursor = NULL;
@@ -2915,7 +2654,6 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
rec = _free(rec);
}
- /*@=nullpass =nullptrarith =nullderef @*/
(void) unblockSignals(db, &signalMask);
@@ -2927,8 +2665,8 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
/* XXX install.c */
int rpmdbAdd(rpmdb db, int iid, Header h,
- /*@unused@*/ rpmts ts,
- /*@unused@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
+ rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
{
DBC * dbcursor = NULL;
DBT * key = alloca(sizeof(*key));
@@ -2951,9 +2689,7 @@ DBT * data = alloca(sizeof(*data));
* we won't have bogus information (i.e. the last succesful
* add).
*/
-/*@-mods@*/
myinstall_instance = 0;
-/*@=mods@*/
if (db == NULL)
return 0;
@@ -2991,7 +2727,6 @@ memset(data, 0, sizeof(*data));
size_t datalen = 0;
dbi = dbiOpen(db, RPMDBI_PACKAGES, 0);
- /*@-branchstate@*/
if (dbi != NULL) {
/* XXX db0: hack to pass sizeof header to fadAlloc */
@@ -3002,19 +2737,16 @@ memset(data, 0, sizeof(*data));
/* Retrieve join key for next header instance. */
-/*@-compmempass@*/
key->data = keyp;
key->size = keylen;
-/*@i@*/ data->data = datap;
+ data->data = datap;
data->size = datalen;
ret = dbiGet(dbi, dbcursor, key, data, DB_SET);
keyp = key->data;
keylen = key->size;
datap = data->data;
datalen = data->size;
-/*@=compmempass@*/
-/*@-bounds@*/
hdrNum = 0;
if (ret == 0 && datap) {
memcpy(&mi_offset, datap, sizeof(mi_offset.ui));
@@ -3032,24 +2764,18 @@ memset(data, 0, sizeof(*data));
datap = &mi_offset;
datalen = sizeof(mi_offset.ui);
}
-/*@=bounds@*/
key->data = keyp;
key->size = keylen;
-/*@-kepttrans@*/
data->data = datap;
-/*@=kepttrans@*/
data->size = datalen;
-/*@-compmempass@*/
ret = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST);
-/*@=compmempass@*/
xx = dbiSync(dbi, 0);
xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR);
dbcursor = NULL;
}
- /*@=branchstate@*/
}
@@ -3066,9 +2792,7 @@ memset(data, 0, sizeof(*data));
dbiIndexItem rec = dbiIndexNewItem(hdrNum, 0);
/* Save the header number for the current transaction. */
-/*@-mods@*/
myinstall_instance = hdrNum;
-/*@=mods@*/
if (dbiTags != NULL)
for (dbix = 0; dbix < dbiTagsMax; dbix++) {
@@ -3084,9 +2808,7 @@ memset(data, 0, sizeof(*data));
rpmrc = RPMRC_NOTFOUND;
dbi = NULL;
requireFlags = NULL;
-/*@-boundsread@*/
rpmtag = dbiTags[dbix];
-/*@=boundsread@*/
/* Filter out temporary databases */
if (isTemporaryDB(rpmtag))
@@ -3102,9 +2824,7 @@ memset(data, 0, sizeof(*data));
mi_offset.ui = hdrNum;
if (dbiByteSwapped(dbi) == 1)
_DBSWAP(mi_offset);
-/*@-immediatetrans@*/
key->data = (void *) &mi_offset;
-/*@=immediatetrans@*/
key->size = sizeof(mi_offset.ui);
data->data = headerUnload(h);
data->size = headerSizeof(h, HEADER_MAGIC_NO);
@@ -3123,9 +2843,7 @@ data->size = headerSizeof(h, HEADER_MAGIC_NO);
}
if (data->data != NULL && rpmrc != RPMRC_FAIL) {
-/*@-compmempass@*/
xx = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST);
-/*@=compmempass@*/
xx = dbiSync(dbi, 0);
}
data->data = _free(data->data);
@@ -3135,22 +2853,21 @@ data->size = 0;
if (!dbi->dbi_no_dbsync)
xx = dbiSync(dbi, 0);
continue;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPMTAG_BASENAMES: /* XXX preserve legacy behavior */
rpmtype = bnt;
rpmvals = baseNames;
rpmcnt = count;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_REQUIRENAME:
xx = hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
xx = hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL);
- /*@switchbreak@*/ break;
+ break;
default:
xx = hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
- /*@switchbreak@*/ break;
+ break;
}
- /*@-branchstate@*/
if (rpmcnt <= 0) {
if (rpmtag != RPMTAG_GROUP)
continue;
@@ -3160,7 +2877,6 @@ data->size = 0;
rpmvals = (const char **) "Unknown";
rpmcnt = 1;
}
- /*@=branchstate@*/
dbi = dbiOpen(db, rpmtag, 0);
if (dbi != NULL) {
@@ -3168,9 +2884,7 @@ data->size = 0;
if (rpmtype == RPM_STRING_TYPE) {
/* XXX force uniform headerGetEntry return */
- /*@-observertrans@*/
av[0] = (const char *) rpmvals;
- /*@=observertrans@*/
rpmvals = av;
rpmcnt = 1;
}
@@ -3191,64 +2905,57 @@ data->size = 0;
rec->tagNum = i;
switch (dbi->dbi_rpmtag) {
case RPMTAG_PUBKEYS:
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_FILEMD5S:
/* Filter out empty MD5 strings. */
if (!(rpmvals[i] && *rpmvals[i] != '\0'))
- /*@innercontinue@*/ continue;
- /*@switchbreak@*/ break;
+ continue;
+ break;
case RPMTAG_REQUIRENAME:
/* Filter out install prerequisites. */
if (requireFlags && isInstallPreReq(requireFlags[i]))
- /*@innercontinue@*/ continue;
- /*@switchbreak@*/ break;
+ continue;
+ break;
case RPMTAG_TRIGGERNAME:
if (i) { /* don't add duplicates */
-/*@-boundsread@*/
for (j = 0; j < i; j++) {
if (!strcmp(rpmvals[i], rpmvals[j]))
- /*@innerbreak@*/ break;
+ break;
}
-/*@=boundsread@*/
if (j < i)
- /*@innercontinue@*/ continue;
+ continue;
}
- /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
/* Identify value pointer and length. */
stringvalued = 0;
-/*@-branchstate@*/
switch (rpmtype) {
-/*@-sizeoftype@*/
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
key->size = sizeof(int_8);
-/*@i@*/ key->data = rpmvals + i;
- /*@switchbreak@*/ break;
+ key->data = rpmvals + i;
+ break;
case RPM_INT16_TYPE:
key->size = sizeof(int_16);
-/*@i@*/ key->data = rpmvals + i;
- /*@switchbreak@*/ break;
+ key->data = rpmvals + i;
+ break;
case RPM_INT32_TYPE:
key->size = sizeof(int_32);
-/*@i@*/ key->data = rpmvals + i;
- /*@switchbreak@*/ break;
-/*@=sizeoftype@*/
+ key->data = rpmvals + i;
+ break;
case RPM_BIN_TYPE:
key->size = rpmcnt;
-/*@i@*/ key->data = rpmvals;
+ key->data = rpmvals;
rpmcnt = 1; /* XXX break out of loop. */
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
case RPM_I18NSTRING_TYPE:
rpmcnt = 1; /* XXX break out of loop. */
- /*@fallthrough@*/
case RPM_STRING_ARRAY_TYPE:
/* Convert from hex to binary. */
-/*@-boundsread@*/
if (dbi->dbi_rpmtag == RPMTAG_FILEMD5S) {
const char * s;
@@ -3258,7 +2965,7 @@ data->size = 0;
*t = (nibble(s[0]) << 4) | nibble(s[1]);
key->data = bin;
key->size = 16;
- /*@switchbreak@*/ break;
+ break;
}
/* Extract the pubkey id from the base64 blob. */
if (dbi->dbi_rpmtag == RPMTAG_PUBKEYS) {
@@ -3267,24 +2974,21 @@ data->size = 0;
size_t pktlen;
if (b64decode(rpmvals[i], (void **)&pkt, &pktlen))
- /*@innercontinue@*/ continue;
+ continue;
(void) pgpPrtPkts(pkt, pktlen, dig, 0);
memcpy(bin, dig->pubkey.signid, 8);
pkt = _free(pkt);
dig = _free(dig);
key->data = bin;
key->size = 8;
- /*@switchbreak@*/ break;
+ break;
}
-/*@=boundsread@*/
- /*@fallthrough@*/
default:
-/*@i@*/ key->data = (void *) rpmvals[i];
+ key->data = (void *) rpmvals[i];
key->size = strlen(rpmvals[i]);
stringvalued = 1;
- /*@switchbreak@*/ break;
+ break;
}
-/*@=branchstate@*/
if (!printed) {
if (rpmcnt == 1 && stringvalued) {
@@ -3306,7 +3010,6 @@ data->size = 0;
if (key->size == 0) key->size = strlen((char *)key->data);
if (key->size == 0) key->size++; /* XXX "/" fixup. */
-/*@-compmempass@*/
rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
if (rc == 0) { /* success */
/* With duplicates, cursor is positioned, discard the record. */
@@ -3317,19 +3020,16 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
_("error(%d) getting \"%s\" records from %s index\n"),
rc, key->data, tagName(dbi->dbi_rpmtag));
ret += 1;
- /*@innercontinue@*/ continue;
+ continue;
}
-/*@=compmempass@*/
if (set == NULL) /* not found or duplicate */
set = xcalloc(1, sizeof(*set));
(void) dbiAppendSet(set, rec, 1, sizeof(*rec), 0);
-/*@-compmempass@*/
(void) set2dbt(dbi, data, set);
rc = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST);
-/*@=compmempass@*/
if (rc) {
rpmError(RPMERR_DBPUTINDEX,
@@ -3337,9 +3037,7 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
rc, key->data, tagName(dbi->dbi_rpmtag));
ret += 1;
}
-/*@-unqualifiedtrans@*/
data->data = _free(data->data);
-/*@=unqualifiedtrans@*/
data->size = 0;
set = dbiFreeIndexSet(set);
}
@@ -3351,14 +3049,11 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
xx = dbiSync(dbi, 0);
}
- /*@-observertrans@*/
if (rpmtype != RPM_BIN_TYPE) /* XXX WTFO? HACK ALERT */
rpmvals = hfd(rpmvals, rpmtype);
- /*@=observertrans@*/
rpmtype = 0;
rpmcnt = 0;
}
- /*@=nullpass =nullptrarith =nullderef @*/
rec = _free(rec);
}
@@ -3371,17 +3066,14 @@ exit:
#define _skip(_dn) { sizeof(_dn)-1, (_dn) }
-/*@unchecked@*/ /*@observer@*/
static struct skipDir_s {
int dnlen;
-/*@observer@*/ /*@null@*/
const char * dn;
} skipDirs[] = {
{ 0, NULL }
};
static int skipDir(const char * dn)
- /*@*/
{
struct skipDir_s * sd = skipDirs;
int dnlen;
@@ -3398,7 +3090,6 @@ static int skipDir(const char * dn)
}
/* XXX transaction.c */
-/*@-compmempass@*/
int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
int numItems)
{
@@ -3423,13 +3114,9 @@ data = &mi->mi_data;
/* Gather all installed headers with matching basename's. */
for (i = 0; i < numItems; i++) {
-/*@-boundswrite@*/
matchList[i] = xcalloc(1, sizeof(*(matchList[i])));
-/*@=boundswrite@*/
-/*@-boundsread -dependenttrans@*/
key->data = (void *) fpList[i].baseName;
-/*@=boundsread =dependenttrans@*/
key->size = strlen((char *)key->data);
if (key->size == 0) key->size++; /* XXX "/" fixup. */
@@ -3468,12 +3155,10 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
im = mi->mi_set->recs + start;
/* Find the end of the set of matched basename's in this package. */
-/*@-boundsread@*/
for (end = start + 1; end < mi->mi_set->count; end++) {
if (im->hdrNum != mi->mi_set->recs[end].hdrNum)
- /*@innerbreak@*/ break;
+ break;
}
-/*@=boundsread@*/
num = end - start;
/* Compute fingerprints for this installed header's matches */
@@ -3483,26 +3168,21 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
baseNames = xcalloc(num, sizeof(*baseNames));
dirIndexes = xcalloc(num, sizeof(*dirIndexes));
-/*@-bounds@*/
for (i = 0; i < num; i++) {
baseNames[i] = fullBaseNames[im[i].tagNum];
dirIndexes[i] = fullDirIndexes[im[i].tagNum];
}
-/*@=bounds@*/
fps = xcalloc(num, sizeof(*fps));
fpLookupList(fpc, dirNames, baseNames, dirIndexes, num, fps);
/* Add db (recnum,filenum) to list for fingerprint matches. */
-/*@-boundsread@*/
for (i = 0; i < num; i++, im++) {
- /*@-nullpass@*/ /* FIX: fpList[].subDir may be NULL */
+ /* FIX: fpList[].subDir may be NULL */
if (!FP_EQUAL(fps[i], fpList[im->fpNum]))
- /*@innercontinue@*/ continue;
- /*@=nullpass@*/
+ continue;
xx = dbiAppendSet(matchList[im->fpNum], im, 1, sizeof(*im), 0);
}
-/*@=boundsread@*/
fps = _free(fps);
dirNames = hfd(dirNames, dnt);
@@ -3520,7 +3200,6 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
return 0;
}
-/*@=compmempass@*/
/**
* Check if file esists using stat(2).
@@ -3528,16 +3207,12 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
* @return 1 if file exists, 0 if not
*/
static int rpmioFileExists(const char * urlfn)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/
{
const char *fn;
int urltype = urlPath(urlfn, &fn);
struct stat buf;
- /*@-branchstate@*/
if (*fn == '\0') fn = "/";
- /*@=branchstate@*/
switch (urltype) {
case URL_IS_HTTPS: /* XXX WRONG WRONG WRONG */
case URL_IS_HTTP: /* XXX WRONG WRONG WRONG */
@@ -3556,7 +3231,7 @@ static int rpmioFileExists(const char * urlfn)
case URL_IS_DASH:
default:
return 0;
- /*@notreached@*/ break;
+ break;
}
return 1;
@@ -3564,15 +3239,12 @@ static int rpmioFileExists(const char * urlfn)
static int rpmdbRemoveDatabase(const char * prefix,
const char * dbpath, int _dbapi)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/
{
int i;
char * filename;
int xx;
i = strlen(dbpath);
- /*@-bounds -branchstate@*/
if (dbpath[i - 1] != '/') {
filename = alloca(i);
strcpy(filename, dbpath);
@@ -3580,19 +3252,15 @@ static int rpmdbRemoveDatabase(const char * prefix,
filename[i + 1] = '\0';
dbpath = filename;
}
- /*@=bounds =branchstate@*/
filename = alloca(strlen(prefix) + strlen(dbpath) + 40);
switch (_dbapi) {
case 4:
- /*@fallthrough@*/
case 3:
if (dbiTags != NULL)
for (i = 0; i < dbiTagsMax; i++) {
-/*@-boundsread@*/
const char * base = tagName(dbiTags[i]);
-/*@=boundsread@*/
sprintf(filename, "%s/%s/%s", prefix, dbpath, base);
(void)rpmCleanPath(filename);
if (!rpmioFileExists(filename))
@@ -3622,9 +3290,7 @@ static int rpmdbRemoveDatabase(const char * prefix,
static int rpmdbMoveDatabase(const char * prefix,
const char * olddbpath, int _olddbapi,
- const char * newdbpath, /*@unused@*/ int _newdbapi)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/
+ const char * newdbpath, int _newdbapi)
{
int i;
char * ofilename, * nfilename;
@@ -3633,7 +3299,6 @@ static int rpmdbMoveDatabase(const char * prefix,
int xx;
i = strlen(olddbpath);
- /*@-branchstate@*/
if (olddbpath[i - 1] != '/') {
ofilename = alloca(i + 2);
strcpy(ofilename, olddbpath);
@@ -3641,10 +3306,8 @@ static int rpmdbMoveDatabase(const char * prefix,
ofilename[i + 1] = '\0';
olddbpath = ofilename;
}
- /*@=branchstate@*/
i = strlen(newdbpath);
- /*@-branchstate@*/
if (newdbpath[i - 1] != '/') {
nfilename = alloca(i + 2);
strcpy(nfilename, newdbpath);
@@ -3652,7 +3315,6 @@ static int rpmdbMoveDatabase(const char * prefix,
nfilename[i + 1] = '\0';
newdbpath = nfilename;
}
- /*@=branchstate@*/
ofilename = alloca(strlen(prefix) + strlen(olddbpath) + 40);
nfilename = alloca(strlen(prefix) + strlen(newdbpath) + 40);
@@ -3735,8 +3397,6 @@ static int rpmdbMoveDatabase(const char * prefix,
int rpmdbRebuild(const char * prefix, rpmts ts,
rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
- /*@globals _rebuildinprogress @*/
- /*@modifies _rebuildinprogress @*/
{
rpmdb olddb;
const char * dbpath = NULL;
@@ -3752,19 +3412,13 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
int _dbapi;
int _dbapi_rebuild;
- /*@-branchstate@*/
if (prefix == NULL) prefix = "/";
- /*@=branchstate@*/
_dbapi = rpmExpandNumeric("%{_dbapi}");
_dbapi_rebuild = rpmExpandNumeric("%{_dbapi_rebuild}");
- /*@-nullpass@*/
tfn = rpmGetPath("%{?_dbpath}", NULL);
- /*@=nullpass@*/
-/*@-boundsread@*/
if (!(tfn && tfn[0] != '\0'))
-/*@=boundsread@*/
{
rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
rc = 1;
@@ -3775,20 +3429,14 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
dbpath += strlen(prefix) - 1;
tfn = _free(tfn);
- /*@-nullpass@*/
tfn = rpmGetPath("%{?_dbpath_rebuild}", NULL);
- /*@=nullpass@*/
-/*@-boundsread@*/
if (!(tfn && tfn[0] != '\0' && strcmp(tfn, dbpath)))
-/*@=boundsread@*/
{
char pidbuf[20];
char *t;
sprintf(pidbuf, "rebuilddb.%d", (int) getpid());
t = xmalloc(strlen(dbpath) + strlen(pidbuf) + 1);
-/*@-boundswrite@*/
(void)stpcpy(stpcpy(t, dbpath), pidbuf);
-/*@=boundswrite@*/
tfn = _free(tfn);
tfn = t;
nocleanup = 0;
@@ -3821,24 +3469,20 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
rpmMessage(RPMMESS_DEBUG, _("opening old database with dbapi %d\n"),
_dbapi);
-/*@-boundswrite@*/
if (openDatabase(prefix, dbpath, _dbapi, &olddb, O_RDONLY, 0644,
RPMDB_FLAG_MINIMAL)) {
rc = 1;
goto exit;
}
-/*@=boundswrite@*/
_dbapi = olddb->db_api;
_rebuildinprogress = 1;
rpmMessage(RPMMESS_DEBUG, _("opening new database with dbapi %d\n"),
_dbapi_rebuild);
(void) rpmDefineMacro(NULL, "_rpmdb_rebuild %{nil}", -1);
-/*@-boundswrite@*/
if (openDatabase(prefix, newdbpath, _dbapi_rebuild, &newdb, O_RDWR | O_CREAT, 0644, 0)) {
rc = 1;
goto exit;
}
-/*@=boundswrite@*/
_rebuildinprogress = 0;
@@ -3873,7 +3517,6 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
(void) headerNVR(h, &name, &version, &release);
- /*@-shadow@*/
{ rpmdbMatchIterator mi;
mi = rpmdbInitIterator(newdb, RPMTAG_NAME, name, 0);
(void) rpmdbSetIteratorRE(mi, RPMTAG_VERSION,
@@ -3882,11 +3525,10 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
RPMMIRE_DEFAULT, release);
while (rpmdbNextIterator(mi)) {
skip = 1;
- /*@innerbreak@*/ break;
+ break;
}
mi = rpmdbFreeIterator(mi);
}
- /*@=shadow@*/
if (skip)
continue;
diff --git a/rpmdb/rpmdb.h b/rpmdb/rpmdb.h
index ad428dfea..67501a120 100644
--- a/rpmdb/rpmdb.h
+++ b/rpmdb/rpmdb.h
@@ -1,6 +1,5 @@
#ifndef H_RPMDB
#define H_RPMDB
-/*@-bounds@*/
/** \ingroup rpmdb dbi db1 db3
* \file rpmdb/rpmdb.h
@@ -12,21 +11,18 @@
#include "rpmsw.h"
#include "db.h"
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _rpmdb_debug;
-/*@=exportlocal@*/
#ifdef NOTYET
/** \ingroup rpmdb
* Database of headers and tag value indices.
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb;
+typedef struct rpmdb_s * rpmdb;
/** \ingroup rpmdb
* Database iterator.
*/
-typedef /*@abstract@*/ struct _rpmdbMatchIterator * rpmdbMatchIterator;
+typedef struct _rpmdbMatchIterator * rpmdbMatchIterator;
#endif
/**
@@ -41,16 +37,16 @@ typedef enum rpmMireMode_e {
/**
*/
-typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem;
+typedef struct _dbiIndexItem * dbiIndexItem;
/** \ingroup rpmdb
* A single element (i.e. inverted list from tag values) of a database.
*/
-typedef /*@abstract@*/ struct _dbiIndexSet * dbiIndexSet;
+typedef struct _dbiIndexSet * dbiIndexSet;
/**
*/
-typedef /*@abstract@*/ struct _dbiIndex * dbiIndex;
+typedef struct _dbiIndex * dbiIndex;
/* this will break if sizeof(int) != 4 */
/** \ingroup dbi
@@ -68,7 +64,7 @@ struct _dbiIndexItem {
* Items retrieved from the index database.
*/
struct _dbiIndexSet {
-/*@owned@*/ struct _dbiIndexItem * recs; /*!< array of records */
+struct _dbiIndexItem * recs; /*!< array of records */
int count; /*!< number of records */
};
@@ -86,9 +82,7 @@ struct _dbiVec {
* @param rpmtag rpm tag
* @return 0 on success
*/
- int (*open) (rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ dbiIndex * dbip)
- /*@globals fileSystem @*/
- /*@modifies *dbip, fileSystem @*/;
+ int (*open) (rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip);
/** \ingroup dbi
* Close index database, and destroy database handle.
@@ -96,9 +90,7 @@ struct _dbiVec {
* @param flags (unused)
* @return 0 on success
*/
- int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/;
+ int (*close) (dbiIndex dbi, unsigned int flags);
/** \ingroup dbi
* Flush pending operations to disk.
@@ -106,9 +98,7 @@ struct _dbiVec {
* @param flags (unused)
* @return 0 on success
*/
- int (*sync) (dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ int (*sync) (dbiIndex dbi, unsigned int flags);
/** \ingroup dbi
* Associate secondary database with primary.
@@ -120,9 +110,7 @@ struct _dbiVec {
*/
int (*associate) (dbiIndex dbi, dbiIndex dbisecondary,
int (*callback) (DB *, const DBT *, const DBT *, DBT *),
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/;
+ unsigned int flags);
/** \ingroup dbi
* Return join cursor for list of cursors.
@@ -132,10 +120,8 @@ struct _dbiVec {
* @param flags DB_JOIN_NOSORT or 0
* @return 0 on success
*/
- int (*join) (dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/;
+ int (*join) (dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
+ unsigned int flags);
/** \ingroup dbi
* Open database cursor.
@@ -145,10 +131,8 @@ struct _dbiVec {
* @param dbiflags DB_WRITECURSOR or 0
* @return 0 on success
*/
- int (*copen) (dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
- /*@out@*/ DBC ** dbcp, unsigned int dbiflags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *txnid, *dbcp, fileSystem @*/;
+ int (*copen) (dbiIndex dbi, DB_TXN * txnid,
+ DBC ** dbcp, unsigned int dbiflags);
/** \ingroup dbi
* Close database cursor.
@@ -157,9 +141,7 @@ struct _dbiVec {
* @param flags (unused)
* @return 0 on success
*/
- int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcursor, fileSystem @*/;
+ int (*cclose) (dbiIndex dbi, DBC * dbcursor, unsigned int flags);
/** \ingroup dbi
* Duplicate a database cursor.
@@ -169,10 +151,8 @@ struct _dbiVec {
* @param flags DB_POSITION for same position, 0 for uninitialized
* @return 0 on success
*/
- int (*cdup) (dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/;
+ int (*cdup) (dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
+ unsigned int flags);
/** \ingroup dbi
* Delete (key,data) pair(s) using db->del or dbcursor->c_del.
@@ -183,10 +163,8 @@ struct _dbiVec {
* @param flags (unused)
* @return 0 on success
*/
- int (*cdel) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/;
+ int (*cdel) (dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
+ unsigned int flags);
/** \ingroup dbi
* Retrieve (key,data) pair using db->get or dbcursor->c_get.
@@ -197,10 +175,8 @@ struct _dbiVec {
* @param flags (unused)
* @return 0 on success
*/
- int (*cget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, *key, *data, fileSystem @*/;
+ int (*cget) (dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
+ unsigned int flags);
/** \ingroup dbi
* Retrieve (key,data) pair using dbcursor->c_pget.
@@ -212,10 +188,8 @@ struct _dbiVec {
* @param flags DB_NEXT, DB_SET, or 0
* @return 0 on success
*/
- int (*cpget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor,
- DBT * key, DBT * pkey, DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/;
+ int (*cpget) (dbiIndex dbi, DBC * dbcursor,
+ DBT * key, DBT * pkey, DBT * data, unsigned int flags);
/** \ingroup dbi
* Store (key,data) pair using db->put or dbcursor->c_put.
@@ -226,10 +200,8 @@ struct _dbiVec {
* @param flags (unused)
* @return 0 on success
*/
- int (*cput) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/;
+ int (*cput) (dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
+ unsigned int flags);
/** \ingroup dbi
* Retrieve count of (possible) duplicate items using dbcursor->c_count.
@@ -240,19 +212,15 @@ struct _dbiVec {
* @return 0 on success
*/
int (*ccount) (dbiIndex dbi, DBC * dbcursor,
- /*@out@*/ unsigned int * countp,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/;
+ unsigned int * countp,
+ unsigned int flags);
/** \ingroup dbi
* Is database byte swapped?
* @param dbi index database handle
* @return 0 no
*/
- int (*byteswapped) (dbiIndex dbi)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ int (*byteswapped) (dbiIndex dbi);
/** \ingroup dbi
* Save statistics in database handle.
@@ -260,24 +228,17 @@ struct _dbiVec {
* @param flags retrieve statistics that don't require traversal?
* @return 0 on success
*/
- int (*stat) (dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/;
+ int (*stat) (dbiIndex dbi, unsigned int flags);
};
/** \ingroup dbi
* Describes an index database (implemented on Berkeley db3 functionality).
*/
struct _dbiIndex {
-/*@null@*/
const char * dbi_root; /*!< chroot(2) component of path */
-/*@null@*/
const char * dbi_home; /*!< directory component of path */
-/*@relnull@*/
const char * dbi_file; /*!< file component of path */
-/*@relnull@*/
const char * dbi_subfile;
-/*@null@*/
const char * dbi_tmpdir; /*!< temporary directory */
int dbi_ecflags; /*!< db_env_create flags */
@@ -303,19 +264,14 @@ struct _dbiIndex {
int dbi_debug;
int dbi_byteswapped;
-/*@null@*/
char * dbi_host;
unsigned long dbi_cl_timeout;
unsigned long dbi_sv_timeout;
/* dbenv parameters */
int dbi_lorder;
-/*@unused@*/
/* XXX db-4.3.14 adds dbenv as 1st arg. */
- void (*db_errcall) (void * dbenv, const char *db_errpfx, char *buffer)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
-/*@unused@*/ /*@shared@*/
+ void (*db_errcall) (void * dbenv, const char *db_errpfx, char *buffer);
FILE * dbi_errfile;
const char * dbi_errpfx;
int dbi_verbose;
@@ -327,8 +283,8 @@ struct _dbiIndex {
/* lock sub-system parameters */
unsigned int dbi_lk_max;
unsigned int dbi_lk_detect;
-/*@unused@*/ int dbi_lk_nmodes;
-/*@unused@*/ unsigned char * dbi_lk_conflicts;
+int dbi_lk_nmodes;
+unsigned char * dbi_lk_conflicts;
/* log sub-system parameters */
unsigned int dbi_lg_max;
unsigned int dbi_lg_bsize;
@@ -336,33 +292,24 @@ struct _dbiIndex {
unsigned int dbi_tx_max;
#if 0
int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_rec,
- DB_LSN *lsnp, int redo, void *info)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ DB_LSN *lsnp, int redo, void *info);
#endif
/* dbinfo parameters */
int dbi_pagesize; /*!< (fs blksize) */
-/*@unused@*/ /*@null@*/
- void * (*dbi_malloc) (size_t nbytes)
- /*@*/;
+ void * (*dbi_malloc) (size_t nbytes);
/* hash access parameters */
unsigned int dbi_h_ffactor; /*!< */
unsigned int (*dbi_h_hash_fcn) (DB *, const void *bytes,
- unsigned int length)
- /*@*/;
+ unsigned int length);
unsigned int dbi_h_nelem; /*!< */
unsigned int dbi_h_flags; /*!< DB_DUP, DB_DUPSORT */
- int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const DBT *)
- /*@*/;
+ int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const DBT *);
/* btree access parameters */
int dbi_bt_flags;
int dbi_bt_minkey;
- int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT *)
- /*@*/;
- int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const DBT *)
- /*@*/;
- size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT *)
- /*@*/;
+ int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT *);
+ int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const DBT *);
+ size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT *);
/* recno access parameters */
int dbi_re_flags;
int dbi_re_delim;
@@ -372,19 +319,14 @@ struct _dbiIndex {
/* queue access parameters */
unsigned int dbi_q_extentsize;
-/*@refcounted@*/
rpmdb dbi_rpmdb; /*!< the parent rpm database */
rpmTag dbi_rpmtag; /*!< rpm tag used for index */
int dbi_jlen; /*!< size of join key */
-/*@only@*//*@null@*/
DB * dbi_db; /*!< Berkeley DB * handle */
-/*@only@*//*@null@*/
DB_TXN * dbi_txnid; /*!< Bekerley DB_TXN * transaction id */
-/*@only@*//*@null@*/
void * dbi_stats; /*!< Berkeley db statistics */
-/*@observer@*/
const struct _dbiVec * dbi_vec; /*!< private methods */
};
@@ -393,38 +335,26 @@ struct _dbiIndex {
* Describes the collection of index databases used by rpm.
*/
struct rpmdb_s {
-/*@owned@*/
const char * db_root;/*!< path prefix */
-/*@owned@*/
const char * db_home;/*!< directory path */
int db_flags;
int db_mode; /*!< open mode */
int db_perms; /*!< open permissions */
int db_api; /*!< Berkeley API type */
-/*@owned@*/
const char * db_errpfx;
int db_remove_env;
int db_filter_dups;
int db_chrootDone; /*!< If chroot(2) done, ignore db_root. */
- void (*db_errcall) (const char *db_errpfx, char *buffer)
- /*@*/;
-/*@shared@*/
+ void (*db_errcall) (const char *db_errpfx, char *buffer);
FILE * db_errfile;
-/*@only@*/
- void * (*db_malloc) (size_t nbytes)
- /*@*/;
-/*@only@*/
- void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr,
- size_t nbytes)
- /*@*/;
- void (*db_free) (/*@only@*/ void * ptr)
- /*@modifies *ptr @*/;
-/*@only@*/ /*@null@*/
+ void * (*db_malloc) (size_t nbytes);
+ void * (*db_realloc) (void * ptr,
+ size_t nbytes);
+ void (*db_free) (void * ptr);
unsigned char * db_bits; /*!< package instance bit mask. */
int db_nbits; /*!< no. of bits in mask. */
rpmdb db_next;
int db_opens;
-/*@only@*/ /*@null@*/
void * db_dbenv; /*!< Berkeley DB_ENV handle. */
int db_ndbi; /*!< No. of tag indices. */
dbiIndex * _dbi; /*!< Tag indices. */
@@ -433,7 +363,6 @@ struct rpmdb_s {
struct rpmop_s db_putops;
struct rpmop_s db_delops;
-/*@refs@*/
int nrefs; /*!< Reference count. */
};
@@ -444,35 +373,27 @@ struct rpmdb_s {
enum rpmdbFlags {
RPMDB_FLAG_JUSTCHECK = (1 << 0),
RPMDB_FLAG_MINIMAL = (1 << 1),
-/*@-enummemuse@*/
RPMDB_FLAG_CHROOT = (1 << 2)
-/*@=enummemuse@*/
};
#ifdef __cplusplus
extern "C" {
#endif
-/*@-exportlocal@*/
/** \ingroup db3
* Return new configured index database handle instance.
* @param rpmdb rpm database
* @param rpmtag rpm tag
* @return index database handle
*/
-/*@unused@*/ /*@only@*/ /*@null@*/
-dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies rpmGlobalMacroContext @*/;
+dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag);
/** \ingroup db3
* Destroy index database handle instance.
* @param dbi index database handle
* @return NULL always
*/
-/*@null@*/
-dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi)
- /*@*/;
+dbiIndex db3Free( dbiIndex dbi);
/** \ingroup db3
* Format db3 open flags for debugging print.
@@ -480,11 +401,7 @@ dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi)
* @param print_dbenv_flags format db env flags instead?
* @return formatted flags (static buffer)
*/
-/*@-redecl@*/
-/*@exposed@*/
-extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
- /*@*/;
-/*@=redecl@*/
+extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags);
/** \ingroup dbi
* Return handle for an index database.
@@ -493,12 +410,10 @@ extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
* @param flags (unused)
* @return index database handle
*/
-/*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, rpmTag rpmtag,
- unsigned int flags)
- /*@globals rpmGlobalMacroContext, errno, h_errno @*/
- /*@modifies db, rpmGlobalMacroContext, errno @*/;
+dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag,
+ unsigned int flags);
-/*@-globuse -mustmod @*/ /* FIX: vector annotations */
+/* FIX: vector annotations */
/** \ingroup dbi
* Open a database cursor.
* @param dbi index database handle
@@ -507,11 +422,9 @@ extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
* @param flags DB_WRITECURSOR if writing, or 0
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiCopen(dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
- /*@out@*/ DBC ** dbcp, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/
+static inline
+int dbiCopen(dbiIndex dbi, DB_TXN * txnid,
+ DBC ** dbcp, unsigned int flags)
{
return (*dbi->dbi_vec->copen) (dbi, txnid, dbcp, flags);
}
@@ -523,10 +436,8 @@ int dbiCopen(dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcursor, fileSystem @*/
+static inline
+int dbiCclose(dbiIndex dbi, DBC * dbcursor, unsigned int flags)
{
return (*dbi->dbi_vec->cclose) (dbi, dbcursor, flags);
}
@@ -539,10 +450,9 @@ int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
* @param flags DB_POSITION for same position, 0 for uninitialized
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiCdup(dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
+static inline
+int dbiCdup(dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
unsigned int flags)
- /*@modifies dbi, *dbcp @*/
{
return (*dbi->dbi_vec->cdup) (dbi, dbcursor, dbcp, flags);
}
@@ -556,11 +466,9 @@ int dbiCdup(dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiDel(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
+static inline
+int dbiDel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
unsigned int flags)
- /*@globals fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, fileSystem, internalState @*/
{
int rc;
assert(key->data != NULL && key->size > 0);
@@ -579,11 +487,9 @@ int dbiDel(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiGet(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
+static inline
+int dbiGet(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
unsigned int flags)
- /*@globals fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, *key, *data, fileSystem, internalState @*/
{
int rc;
assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
@@ -603,11 +509,9 @@ int dbiGet(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
* @param flags DB_NEXT, DB_SET, or 0
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiPget(dbiIndex dbi, /*@null@*/ DBC * dbcursor,
+static inline
+int dbiPget(dbiIndex dbi, DBC * dbcursor,
DBT * key, DBT * pkey, DBT * data, unsigned int flags)
- /*@globals fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, *key, *pkey, *data, fileSystem, internalState @*/
{
int rc;
assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
@@ -626,11 +530,9 @@ int dbiPget(dbiIndex dbi, /*@null@*/ DBC * dbcursor,
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiPut(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
+static inline
+int dbiPut(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
unsigned int flags)
- /*@globals fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, *key, fileSystem, internalState @*/
{
int rc;
assert(key->data != NULL && key->size > 0 && data->data != NULL && data->size > 0);
@@ -648,11 +550,9 @@ int dbiPut(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp,
+static inline
+int dbiCount(dbiIndex dbi, DBC * dbcursor, unsigned int * countp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/
{
return (*dbi->dbi_vec->ccount) (dbi, dbcursor, countp, flags);
}
@@ -663,10 +563,8 @@ int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp,
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
+static inline
+int dbiVerify(dbiIndex dbi, unsigned int flags)
{
dbi->dbi_verify_on_close = 1;
return (*dbi->dbi_vec->close) (dbi, flags);
@@ -678,10 +576,8 @@ int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags)
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
+static inline
+int dbiClose(dbiIndex dbi, unsigned int flags)
{
return (*dbi->dbi_vec->close) (dbi, flags);
}
@@ -692,10 +588,8 @@ int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags)
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
+static inline
int dbiSync (dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
return (*dbi->dbi_vec->sync) (dbi, flags);
}
@@ -708,12 +602,10 @@ int dbiSync (dbiIndex dbi, unsigned int flags)
* @param flags DB_CREATE or 0
* @return 0 on success
*/
-/*@unused@*/ static inline
+static inline
int dbiAssociate(dbiIndex dbi, dbiIndex dbisecondary,
int (*callback) (DB *, const DBT *, const DBT *, DBT *),
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
{
return (*dbi->dbi_vec->associate) (dbi, dbisecondary, callback, flags);
}
@@ -726,11 +618,9 @@ int dbiAssociate(dbiIndex dbi, dbiIndex dbisecondary,
* @param flags DB_JOIN_NOSORT or 0
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiJoin(dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
+static inline
+int dbiJoin(dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/
{
return (*dbi->dbi_vec->join) (dbi, curslist, dbcp, flags);
}
@@ -740,9 +630,8 @@ int dbiJoin(dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
* @param dbi index database handle
* @return 0 same order, 1 swapped order
*/
-/*@unused@*/ static inline
+static inline
int dbiByteSwapped(dbiIndex dbi)
- /*@modifies dbi @*/
{
if (dbi->dbi_byteswapped == -1)
dbi->dbi_byteswapped = (*dbi->dbi_vec->byteswapped) (dbi);
@@ -754,36 +643,30 @@ int dbiByteSwapped(dbiIndex dbi)
* @param flags DB_FAST_STAT or 0
* @return 0 on success
*/
-/*@unused@*/ static inline
+static inline
int dbiStat(dbiIndex dbi, unsigned int flags)
- /*@modifies dbi @*/
{
return (*dbi->dbi_vec->stat) (dbi, flags);
}
-/*@=globuse =mustmod @*/
-/*@=exportlocal@*/
/** \ingroup rpmdb
*/
-unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi)
- /*@*/;
+unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi);
/** \ingroup dbi
* Destroy set of index database items.
* @param set set of index database items
* @return NULL always
*/
-/*@null@*/ dbiIndexSet dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set)
- /*@modifies set @*/;
+dbiIndexSet dbiFreeIndexSet(dbiIndexSet set);
/** \ingroup dbi
* Count items in index database set.
* @param set set of index database items
* @return number of items
*/
-unsigned int dbiIndexSetCount(dbiIndexSet set)
- /*@*/;
+unsigned int dbiIndexSetCount(dbiIndexSet set);
/** \ingroup dbi
* Return record offset of header from element in index database set.
@@ -791,8 +674,7 @@ unsigned int dbiIndexSetCount(dbiIndexSet set)
* @param recno index of item in set
* @return record offset of header
*/
-unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno)
- /*@*/;
+unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno);
/** \ingroup dbi
* Return file index from element in index database set.
@@ -800,18 +682,13 @@ unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno)
* @param recno index of item in set
* @return file index
*/
-unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno)
- /*@*/;
+unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno);
/** \ingroup rpmdb
* Tags for which rpmdb indices will be built.
*/
-/*@-exportlocal@*/
-/*@unchecked@*/
-/*@only@*/ /*@null@*/ extern int * dbiTags;
-/*@unchecked@*/
+extern int * dbiTags;
extern int dbiTagsMax;
-/*@=exportlocal@*/
/** \ingroup rpmdb
* Unreference a database instance.
@@ -819,17 +696,11 @@ extern int dbiTagsMax;
* @param msg
* @return NULL always
*/
-/*@unused@*/ /*@null@*/
-rpmdb rpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg)
- /*@modifies db @*/;
+rpmdb rpmdbUnlink (rpmdb db, const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@-exportlocal@*/
-/*@null@*/
-rpmdb XrpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg,
- const char * fn, unsigned ln)
- /*@modifies db @*/;
-/*@=exportlocal@*/
+rpmdb XrpmdbUnlink (rpmdb db, const char * msg,
+ const char * fn, unsigned ln);
#define rpmdbUnlink(_db, _msg) XrpmdbUnlink(_db, _msg, __FILE__, __LINE__)
/** \ingroup rpmdb
@@ -838,16 +709,11 @@ rpmdb XrpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg,
* @param msg
* @return new rpm database reference
*/
-/*@unused@*/
-rpmdb rpmdbLink (rpmdb db, const char * msg)
- /*@modifies db @*/;
+rpmdb rpmdbLink (rpmdb db, const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@-exportlocal@*/
rpmdb XrpmdbLink (rpmdb db, const char * msg,
- const char * fn, unsigned ln)
- /*@modifies db @*/;
-/*@=exportlocal@*/
+ const char * fn, unsigned ln);
#define rpmdbLink(_db, _msg) XrpmdbLink(_db, _msg, __FILE__, __LINE__)
/** \ingroup rpmdb
@@ -858,10 +724,8 @@ rpmdb XrpmdbLink (rpmdb db, const char * msg,
* @param perms database permissions
* @return 0 on success
*/
-int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp,
- int mode, int perms)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies *dbp, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbOpen (const char * prefix, rpmdb * dbp,
+ int mode, int perms);
/** \ingroup rpmdb
* Initialize database.
@@ -869,18 +733,14 @@ int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp,
* @param perms database permissions
* @return 0 on success
*/
-int rpmdbInit(/*@null@*/ const char * prefix, int perms)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbInit(const char * prefix, int perms);
/** \ingroup rpmdb
* Verify database components.
* @param prefix path to top of install tree
* @return 0 on success
*/
-int rpmdbVerify(/*@null@*/ const char * prefix)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbVerify(const char * prefix);
/**
* Close a single database index.
@@ -888,38 +748,28 @@ int rpmdbVerify(/*@null@*/ const char * prefix)
* @param rpmtag rpm tag
* @return 0 on success
*/
-int rpmdbCloseDBI(/*@null@*/ rpmdb db, int rpmtag)
- /*@globals fileSystem @*/
- /*@modifies db, fileSystem @*/;
+int rpmdbCloseDBI(rpmdb db, int rpmtag);
/** \ingroup rpmdb
* Close all database indices and free rpmdb.
* @param db rpm database
* @return 0 on success
*/
-int rpmdbClose (/*@killref@*/ /*@only@*/ /*@null@*/ rpmdb db)
- /*@globals fileSystem @*/
- /*@modifies db, fileSystem @*/;
+int rpmdbClose (rpmdb db);
/** \ingroup rpmdb
* Sync all database indices.
* @param db rpm database
* @return 0 on success
*/
-int rpmdbSync (/*@null@*/ rpmdb db)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+int rpmdbSync (rpmdb db);
/** \ingroup rpmdb
* Open all database indices.
* @param db rpm database
* @return 0 on success
*/
-/*@-exportlocal@*/
-int rpmdbOpenAll (/*@null@*/ rpmdb db)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies db, rpmGlobalMacroContext @*/;
-/*@=exportlocal@*/
+int rpmdbOpenAll (rpmdb db);
/** \ingroup rpmdb
* Return number of instances of package in rpm database.
@@ -927,25 +777,21 @@ int rpmdbOpenAll (/*@null@*/ rpmdb db)
* @param name rpm package name
* @return number of instances
*/
-int rpmdbCountPackages(/*@null@*/ rpmdb db, const char * name)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbCountPackages(rpmdb db, const char * name);
/** \ingroup rpmdb
* Return header join key for current position of rpm database iterator.
* @param mi rpm database iterator
* @return current header join key
*/
-unsigned int rpmdbGetIteratorOffset(/*@null@*/ rpmdbMatchIterator mi)
- /*@*/;
+unsigned int rpmdbGetIteratorOffset(rpmdbMatchIterator mi);
/** \ingroup rpmdb
* Return number of elements in rpm database iterator.
* @param mi rpm database iterator
* @return number of elements
*/
-int rpmdbGetIteratorCount(/*@null@*/ rpmdbMatchIterator mi)
- /*@*/;
+int rpmdbGetIteratorCount(rpmdbMatchIterator mi);
/** \ingroup rpmdb
* Append items to set of package instances to iterate.
@@ -954,9 +800,8 @@ int rpmdbGetIteratorCount(/*@null@*/ rpmdbMatchIterator mi)
* @param nHdrNums number of elements in array
* @return 0 on success, 1 on failure (bad args)
*/
-int rpmdbAppendIterator(/*@null@*/ rpmdbMatchIterator mi,
- /*@null@*/ const int * hdrNums, int nHdrNums)
- /*@modifies mi @*/;
+int rpmdbAppendIterator(rpmdbMatchIterator mi,
+ const int * hdrNums, int nHdrNums);
/** \ingroup rpmdb
* Remove items from set of package instances to iterate.
@@ -967,9 +812,8 @@ int rpmdbAppendIterator(/*@null@*/ rpmdbMatchIterator mi,
* @param sorted is the array sorted? (array will be sorted on return)
* @return 0 on success, 1 on failure (bad args)
*/
-int rpmdbPruneIterator(/*@null@*/ rpmdbMatchIterator mi,
- /*@null@*/ int * hdrNums, int nHdrNums, int sorted)
- /*@modifies mi, hdrNums @*/;
+int rpmdbPruneIterator(rpmdbMatchIterator mi,
+ int * hdrNums, int nHdrNums, int sorted);
/** \ingroup rpmdb
* Add pattern to iterator selector.
@@ -979,10 +823,8 @@ int rpmdbPruneIterator(/*@null@*/ rpmdbMatchIterator mi,
* @param pattern pattern to match
* @return 0 on success
*/
-int rpmdbSetIteratorRE(/*@null@*/ rpmdbMatchIterator mi, rpmTag tag,
- rpmMireMode mode, /*@null@*/ const char * pattern)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies mi, mode, rpmGlobalMacroContext @*/;
+int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
+ rpmMireMode mode, const char * pattern);
/** \ingroup rpmdb
* Prepare iterator for lazy writes.
@@ -991,8 +833,7 @@ int rpmdbSetIteratorRE(/*@null@*/ rpmdbMatchIterator mi, rpmTag tag,
* @param rewrite new value of rewrite
* @return previous value
*/
-int rpmdbSetIteratorRewrite(/*@null@*/ rpmdbMatchIterator mi, int rewrite)
- /*@modifies mi @*/;
+int rpmdbSetIteratorRewrite(rpmdbMatchIterator mi, int rewrite);
/** \ingroup rpmdb
* Modify iterator to mark header for lazy write on release.
@@ -1000,8 +841,7 @@ int rpmdbSetIteratorRewrite(/*@null@*/ rpmdbMatchIterator mi, int rewrite)
* @param modified new value of modified
* @return previous value
*/
-int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified)
- /*@modifies mi @*/;
+int rpmdbSetIteratorModified(rpmdbMatchIterator mi, int modified);
/** \ingroup rpmdb
* Modify iterator to verify retrieved header blobs.
@@ -1010,9 +850,8 @@ int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified)
* @param (*hdrchk) headerCheck() vector
* @return 0 always
*/
-int rpmdbSetHdrChk(/*@null@*/ rpmdbMatchIterator mi, /*@null@*/ rpmts ts,
- /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg))
- /*@modifies mi @*/;
+int rpmdbSetHdrChk(rpmdbMatchIterator mi, rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg));
/** \ingroup rpmdb
* Return database iterator.
@@ -1022,29 +861,20 @@ int rpmdbSetHdrChk(/*@null@*/ rpmdbMatchIterator mi, /*@null@*/ rpmts ts,
* @param keylen key data length (0 will use strlen(keyp))
* @return NULL on failure
*/
-/*@only@*/ /*@null@*/
-rpmdbMatchIterator rpmdbInitIterator(/*@null@*/ rpmdb db, rpmTag rpmtag,
- /*@null@*/ const void * keyp, size_t keylen)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
+rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag,
+ const void * keyp, size_t keylen);
/** \ingroup rpmdb
* Return next package header from iteration.
* @param mi rpm database iterator
* @return NULL on end of iteration.
*/
-/*@null@*/
-Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
+Header rpmdbNextIterator(rpmdbMatchIterator mi);
/** \ingroup rpmdb
* Check for and exit on termination signals.
*/
-/*@mayexit@*/
-int rpmdbCheckSignals(void)
- /*@globals fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/;
+int rpmdbCheckSignals(void);
/** \ingroup rpmdb
* Check rpmdb signal handler for trapped signal and/or requested exit,
@@ -1061,10 +891,7 @@ int rpmdbCheckTerminate(int terminate);
* @param mi rpm database iterator
* @return NULL always
*/
-/*@null@*/
-rpmdbMatchIterator rpmdbFreeIterator(/*@only@*/ /*@null@*/rpmdbMatchIterator mi)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
+rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
/** \ingroup rpmdb
* Add package header to rpm database and indices.
@@ -1075,10 +902,8 @@ rpmdbMatchIterator rpmdbFreeIterator(/*@only@*/ /*@null@*/rpmdbMatchIterator mi)
* @param (*hdrchk) (unused) headerCheck() vector (or NULL)
* @return 0 on success
*/
-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 rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbAdd(rpmdb db, int iid, Header h, rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg));
/** \ingroup rpmdb
* Remove package header from rpm database and indices.
@@ -1089,11 +914,9 @@ int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts,
* @param (*hdrchk) (unused) headerCheck() vector (or NULL)
* @return 0 on success
*/
-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 rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbRemove(rpmdb db, int rid, unsigned int hdrNum,
+ rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg));
/** \ingroup rpmdb
* Rebuild database indices from package headers.
@@ -1102,20 +925,15 @@ int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
* @param (*hdrchk) headerCheck() vector (or NULL)
* @return 0 on success
*/
-int rpmdbRebuild(/*@null@*/ const char * prefix, /*@null@*/ rpmts ts,
- /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbRebuild(const char * prefix, rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg));
#ifndef __APPLE__
/**
* Mergesort, same arguments as qsort(2).
*/
-/*@unused@*/
int mergesort(void *base, size_t nmemb, size_t size,
- int (*cmp) (const void *, const void *))
- /*@globals errno @*/
- /*@modifies base, errno @*/;
+ int (*cmp) (const void *, const void *));
#else
/* mergesort is defined in stdlib.h on Mac OS X */
#endif /* __APPLE__ */
@@ -1124,5 +942,4 @@ int mergesort(void *base, size_t nmemb, size_t size,
}
#endif
-/*@=bounds@*/
#endif /* H_RPMDB */
diff --git a/rpmdb/rpmhash.c b/rpmdb/rpmhash.c
index a95718f16..e859464ba 100644
--- a/rpmdb/rpmhash.c
+++ b/rpmdb/rpmhash.c
@@ -8,17 +8,17 @@
#include "rpmhash.h"
#include "debug.h"
-typedef /*@owned@*/ const void * voidptr;
+typedef const void * voidptr;
typedef struct hashBucket_s * hashBucket;
/**
*/
struct hashBucket_s {
- voidptr key; /*!< hash key */
-/*@owned@*/ voidptr * data; /*!< pointer to hashed data */
- int dataCount; /*!< length of data (0 if unknown) */
-/*@dependent@*/hashBucket next; /*!< pointer to next item in bucket */
+ voidptr key; /*!< hash key */
+voidptr * data; /*!< pointer to hashed data */
+ int dataCount; /*!< length of data (0 if unknown) */
+ hashBucket next; /*!< pointer to next item in bucket */
};
/**
@@ -38,22 +38,17 @@ struct hashTable_s {
* @param key pointer to key value
* @return pointer to hash bucket of key (or NULL)
*/
-static /*@shared@*/ /*@null@*/
+static
hashBucket findEntry(hashTable ht, const void * key)
- /*@*/
{
unsigned int hash;
hashBucket b;
- /*@-modunconnomods@*/
hash = ht->fn(key) % ht->numBuckets;
-/*@-boundsread@*/
b = ht->buckets[hash];
-/*@=boundsread@*/
while (b && b->key && ht->eq(b->key, key))
b = b->next;
- /*@=modunconnomods@*/
return b;
}
@@ -74,12 +69,10 @@ unsigned int hashFunctionString(const void * string)
const char * chp = string;
len = strlen(string);
-/*@-boundsread@*/
for (i = 0; i < len; i++, chp++) {
xorValue ^= *chp;
sum += *chp;
}
-/*@=boundsread@*/
return ((((unsigned)len) << 16) + (((unsigned)sum) << 8) + xorValue);
}
@@ -94,15 +87,12 @@ hashTable htCreate(int numBuckets, int keySize, int freeData,
ht->buckets = xcalloc(numBuckets, sizeof(*ht->buckets));
ht->keySize = keySize;
ht->freeData = freeData;
- /*@-assignexpose@*/
ht->fn = fn;
ht->eq = eq;
- /*@=assignexpose@*/
return ht;
}
-/*@-boundswrite@*/
void htAddEntry(hashTable ht, const void * key, const void * data)
{
unsigned int hash;
@@ -114,7 +104,6 @@ void htAddEntry(hashTable ht, const void * key, const void * data)
while (b && b->key && ht->eq(b->key, key))
b = b->next;
- /*@-branchstate@*/
if (b == NULL) {
b = xmalloc(sizeof(*b));
if (ht->keySize) {
@@ -129,12 +118,10 @@ void htAddEntry(hashTable ht, const void * key, const void * data)
b->data = NULL;
ht->buckets[hash] = b;
}
- /*@=branchstate@*/
b->data = xrealloc(b->data, sizeof(*b->data) * (b->dataCount + 1));
b->data[b->dataCount++] = data;
}
-/*@=boundswrite@*/
hashTable htFree(hashTable ht)
{
@@ -142,27 +129,19 @@ hashTable htFree(hashTable ht)
int i;
for (i = 0; i < ht->numBuckets; i++) {
-/*@-boundsread@*/
b = ht->buckets[i];
-/*@=boundsread@*/
if (b == NULL)
continue;
-/*@-boundswrite@*/
ht->buckets[i] = NULL;
-/*@=boundswrite@*/
if (ht->keySize > 0)
b->key = _free(b->key);
do {
n = b->next;
- /*@-branchstate@*/
if (b->data) {
-/*@-boundswrite@*/
if (ht->freeData)
*b->data = _free(*b->data);
-/*@=boundswrite@*/
b->data = _free(b->data);
}
- /*@=branchstate@*/
b = _free(b);
} while ((b = n) != NULL);
}
@@ -187,14 +166,12 @@ int htGetEntry(hashTable ht, const void * key, const void *** data,
if ((b = findEntry(ht, key)) == NULL)
return 1;
-/*@-boundswrite@*/
if (data)
*data = (const void **) b->data;
if (dataCount)
*dataCount = b->dataCount;
if (tableKey)
*tableKey = b->key;
-/*@=boundswrite@*/
return 0;
}
diff --git a/rpmdb/rpmhash.h b/rpmdb/rpmhash.h
index 89fcfa83a..b06d49b8a 100644
--- a/rpmdb/rpmhash.h
+++ b/rpmdb/rpmhash.h
@@ -8,7 +8,7 @@
/**
*/
-typedef /*@abstract@*/ struct hashTable_s * hashTable;
+typedef struct hashTable_s * hashTable;
#ifdef __cplusplus
extern "C" {
@@ -16,21 +16,18 @@ extern "C" {
/**
*/
-typedef unsigned int (*hashFunctionType) (const void * string)
- /*@*/;
+typedef unsigned int (*hashFunctionType) (const void * string);
/**
*/
-typedef int (*hashEqualityType) (const void * key1, const void * key2)
- /*@*/;
+typedef int (*hashEqualityType) (const void * key1, const void * key2);
/**
* Return hash value of a string
* @param string string on which to calculate hash value
* @return hash value
*/
-unsigned int hashFunctionString(const void * string)
- /*@*/;
+unsigned int hashFunctionString(const void * string);
/**
* Compare two hash table entries for equality.
@@ -38,8 +35,7 @@ unsigned int hashFunctionString(const void * string)
* @param key2 entry 2
* @return 0 if entries are equal
*/
-int hashEqualityString(const void * key1, const void * key2)
- /*@*/;
+int hashEqualityString(const void * key1, const void * key2);
/**
* Create hash table.
@@ -53,17 +49,14 @@ int hashEqualityString(const void * key1, const void * key2)
* @return pointer to initialized hash table
*/
hashTable htCreate(int numBuckets, int keySize, int freeData,
- hashFunctionType fn, hashEqualityType eq)
- /*@*/;
+ hashFunctionType fn, hashEqualityType eq);
/**
* Destroy hash table.
* @param ht pointer to hash table
* @return NULL always
*/
-/*@null@*/
-hashTable htFree( /*@only@*/ hashTable ht)
- /*@modifies ht @*/;
+hashTable htFree( hashTable ht);
/**
* Add item to hash table.
@@ -71,9 +64,8 @@ hashTable htFree( /*@only@*/ hashTable ht)
* @param key pointer to key
* @param data pointer to data value
*/
-void htAddEntry(hashTable ht, /*@owned@*/ const void * key,
- /*@owned@*/ const void * data)
- /*@modifies ht */;
+void htAddEntry(hashTable ht, const void * key,
+ const void * data);
/**
* Retrieve item from hash table.
@@ -85,10 +77,9 @@ void htAddEntry(hashTable ht, /*@owned@*/ const void * key,
* @return 0 on success, 1 if the item is not found.
*/
int htGetEntry(hashTable ht, const void * key,
- /*@null@*/ /*@out@*/ const void *** data,
- /*@null@*/ /*@out@*/ int * dataCount,
- /*@null@*/ /*@out@*/ const void ** tableKey)
- /*@modifies *data, *dataCount, *tableKey @*/;
+ const void *** data,
+ int * dataCount,
+ const void ** tableKey);
/**
* Check for key in hash table.
@@ -96,9 +87,7 @@ int htGetEntry(hashTable ht, const void * key,
* @param key pointer to key value
* @return 1 if the key is present, 0 otherwise
*/
-/*@unused@*/
-int htHasEntry(hashTable ht, const void * key)
- /*@*/;
+int htHasEntry(hashTable ht, const void * key);
#ifdef __cplusplus
}
diff --git a/rpmdb/sqlite.c b/rpmdb/sqlite.c
index 831ba9a90..9784baf22 100644
--- a/rpmdb/sqlite.c
+++ b/rpmdb/sqlite.c
@@ -1,14 +1,3 @@
-/*@-bounds@*/
-/*@-mustmod@*/
-/*@-paramuse@*/
-/*@-globuse@*/
-/*@-moduncon@*/
-/*@-noeffectuncon@*/
-/*@-compdef@*/
-/*@-compmempass@*/
-/*@-branchstate@*/
-/*@-modfilesystem@*/
-/*@-evalorderuncon@*/
/*
* sqlite.c
@@ -47,10 +36,7 @@
#include "debug.h"
-/*@access rpmdb @*/
-/*@access dbiIndex @*/
-/*@unchecked@*/
static int _debug = 0;
/* Define the things normally in a header... */
@@ -65,16 +51,12 @@ struct _sql_db_s {
struct _sql_dbcursor_s {
DB *dbp;
-/*@only@*/ /*@relnull@*/
char * cmd; /* SQL command string */
-/*@only@*/ /*@relnull@*/
sqlite3_stmt *pStmt; /* SQL byte code */
const char * pzErrmsg; /* SQL error msg */
/* Table -- result of query */
-/*@only@*/ /*@null@*/
char ** av; /* item ptrs */
-/*@only@*/ /*@null@*/
int * avlen; /* item sizes */
int nalloc;
int ac; /* no. of items */
@@ -105,7 +87,6 @@ union _dbswap {
_b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \
}
-/*@unchecked@*/
static unsigned int endian = 0x11223344;
static char * sqlCwd = NULL;
@@ -160,7 +141,6 @@ assert(xx == 0);
}
static void dbg_scp(void *ptr)
- /*@*/
{
SCP_t scp = ptr;
@@ -169,9 +149,8 @@ fprintf(stderr, "\tscp %p [%d:%d] av %p avlen %p nr [%d:%d] nc %d all %d\n", scp
}
-static void dbg_keyval(const char * msg, dbiIndex dbi, /*@null@*/ DBC * dbcursor,
+static void dbg_keyval(const char * msg, dbiIndex dbi, DBC * dbcursor,
DBT * key, DBT * data, unsigned int flags)
- /*@*/
{
if (!_debug) return;
@@ -191,9 +170,8 @@ if (!_debug) return;
dbg_scp(dbcursor);
}
-/*@only@*/
-static SCP_t scpResetKeys(/*@only@*/ SCP_t scp)
- /*@modifies scp @*/
+
+static SCP_t scpResetKeys(SCP_t scp)
{
int ix;
@@ -211,9 +189,8 @@ dbg_scp(scp);
return scp;
}
-/*@only@*/
-static SCP_t scpResetAv(/*@only@*/ SCP_t scp)
- /*@modifies scp @*/
+
+static SCP_t scpResetAv(SCP_t scp)
{
int xx;
@@ -248,9 +225,8 @@ dbg_scp(scp);
return scp;
}
-/*@only@*/
-static SCP_t scpReset(/*@only@*/ SCP_t scp)
- /*@modifies scp @*/
+
+static SCP_t scpReset(SCP_t scp)
{
int xx;
@@ -276,9 +252,7 @@ dbg_scp(scp);
return scp;
}
-/*@null@*/
-static SCP_t scpFree(/*@only@*/ SCP_t scp)
- /*@modifies scp @*/
+static SCP_t scpFree(SCP_t scp)
{
scp = scpReset(scp);
scp = scpResetKeys(scp);
@@ -292,7 +266,6 @@ fprintf(stderr, "*** %s(%p)\n", __FUNCTION__, scp);
}
static SCP_t scpNew(DB * dbp)
- /*@*/
{
SCP_t scp = xcalloc(1, sizeof(*scp));
scp->dbp = dbp;
@@ -308,7 +281,6 @@ fprintf(stderr, "*** %s(%p)\n", __FUNCTION__, scp);
}
static int sql_step(dbiIndex dbi, SCP_t scp)
- /*@modifies scp @*/
{
const char * cname;
const char * vtype;
@@ -345,7 +317,6 @@ assert(scp->ac <= scp->nalloc);
}
}
-/*@-infloopsuncon@*/
loop = 1;
while (loop) {
rc = sqlite3_step(scp->pStmt);
@@ -354,7 +325,7 @@ assert(scp->ac <= scp->nalloc);
if (_debug)
fprintf(stderr, "sqlite3_step: DONE scp %p [%d:%d] av %p avlen %p\n", scp, scp->ac, scp->nalloc, scp->av, scp->avlen);
loop = 0;
- /*@switchbreak@*/ break;
+ break;
case SQLITE_ROW:
if (scp->av != NULL)
for (i = 0; i < scp->nc; i++) {
@@ -438,28 +409,27 @@ fprintf(stderr, "\t%d %s %s \"%s\"\n", i, cname, vtype, v);
assert(scp->ac <= scp->nalloc);
}
scp->nr++;
- /*@switchbreak@*/ break;
+ break;
case SQLITE_BUSY:
fprintf(stderr, "sqlite3_step: BUSY %d\n", rc);
- /*@switchbreak@*/ break;
+ break;
case SQLITE_ERROR:
fprintf(stderr, "sqlite3_step: ERROR %d -- %s\n", rc, scp->cmd);
fprintf(stderr, " %s (%d)\n",
sqlite3_errmsg(((SQL_DB*)dbi->dbi_db)->db), sqlite3_errcode(((SQL_DB*)dbi->dbi_db)->db));
fprintf(stderr, " cwd '%s'\n", getcwd(NULL,0));
loop = 0;
- /*@switchbreak@*/ break;
+ break;
case SQLITE_MISUSE:
fprintf(stderr, "sqlite3_step: MISUSE %d\n", rc);
loop = 0;
- /*@switchbreak@*/ break;
+ break;
default:
fprintf(stderr, "sqlite3_step: rc %d\n", rc);
loop = 0;
- /*@switchbreak@*/ break;
+ break;
}
}
-/*@=infloopsuncon@*/
if (rc == SQLITE_DONE)
rc = SQLITE_OK;
@@ -468,7 +438,6 @@ assert(scp->ac <= scp->nalloc);
}
static int sql_bind_key(dbiIndex dbi, SCP_t scp, int pos, DBT * key)
- /*@modifies scp @*/
{
int rc = 0;
@@ -488,13 +457,13 @@ if (dbiByteSwapped(dbi) == 1)
memcpy(&hnum, &dbswap.ui, sizeof(dbswap.ui));
}
rc = sqlite3_bind_int(scp->pStmt, pos, hnum);
- } /*@innerbreak@*/ break;
+ } break;
default:
switch (tagType(dbi->dbi_rpmtag)) {
case RPM_NULL_TYPE:
case RPM_BIN_TYPE:
rc = sqlite3_bind_blob(scp->pStmt, pos, key->data, key->size, SQLITE_STATIC);
- /*@innerbreak@*/ break;
+ break;
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
{ unsigned char i;
@@ -502,14 +471,14 @@ assert(key->size == sizeof(unsigned char));
assert(dbiByteSwapped(dbi) == 0); /* Byte swap?! */
memcpy(&i, key->data, sizeof(i));
rc = sqlite3_bind_int(scp->pStmt, pos, i);
- } /*@innerbreak@*/ break;
+ } break;
case RPM_INT16_TYPE:
{ unsigned short i;
assert(key->size == sizeof(int_16));
assert(dbiByteSwapped(dbi) == 0); /* Byte swap?! */
memcpy(&i, key->data, sizeof(i));
rc = sqlite3_bind_int(scp->pStmt, pos, i);
- } /*@innerbreak@*/ break;
+ } break;
case RPM_INT32_TYPE:
/* case RPM_INT64_TYPE: */
default:
@@ -524,12 +493,12 @@ if (dbiByteSwapped(dbi) == 1)
memcpy(&i, &dbswap.ui, sizeof(dbswap.ui));
}
rc = sqlite3_bind_int(scp->pStmt, pos, i);
- } /*@innerbreak@*/ break;
+ } break;
case RPM_STRING_TYPE:
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
rc = sqlite3_bind_text(scp->pStmt, pos, key->data, key->size, SQLITE_STATIC);
- /*@innerbreak@*/ break;
+ break;
}
}
@@ -537,7 +506,6 @@ if (dbiByteSwapped(dbi) == 1)
}
static int sql_bind_data(dbiIndex dbi, SCP_t scp, int pos, DBT * data)
- /*@modifies scp @*/
{
int rc;
@@ -553,7 +521,6 @@ assert(data->data != NULL);
*/
static int sql_startTransaction(dbiIndex dbi)
- /*@*/
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
int rc = 0;
@@ -575,7 +542,6 @@ fprintf(stderr, "Begin %s SQL transaction %s (%d)\n",
}
static int sql_endTransaction(dbiIndex dbi)
- /*@*/
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
int rc=0;
@@ -597,7 +563,6 @@ fprintf(stderr, "End %s SQL transaction %s (%d)\n",
}
static int sql_commitTransaction(dbiIndex dbi, int flag)
- /*@*/
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
int rc = 0;
@@ -622,11 +587,8 @@ fprintf(stderr, "Commit %s SQL transaction(s) %s (%d)\n",
}
static int sql_busy_handler(void * dbi_void, int time)
- /*@*/
{
-/*@-castexpose@*/
dbiIndex dbi = (dbiIndex) dbi_void;
-/*@=castexpose@*/
rpmMessage(RPMMESS_WARNING, _("Unable to get lock on db %s, retrying... (%d)\n"),
dbi->dbi_file, time);
@@ -644,7 +606,6 @@ static int sql_busy_handler(void * dbi_void, int time)
* Create the table.. create the db_info
*/
static int sql_initDB(dbiIndex dbi)
- /*@*/
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = scpNew(dbi->dbi_db);
@@ -655,10 +616,8 @@ static int sql_initDB(dbiIndex dbi)
sprintf(cmd,
"SELECT name FROM 'sqlite_master' WHERE type='table' and name='%s';",
dbi->dbi_subfile);
-/*@-nullstate@*/
rc = sqlite3_get_table(sqldb->db, cmd,
&scp->av, &scp->nr, &scp->nc, (char **)&scp->pzErrmsg);
-/*@=nullstate@*/
if (rc)
goto exit;
@@ -677,19 +636,19 @@ static int sql_initDB(dbiIndex dbi)
case RPM_BIN_TYPE:
default:
keytype = "blob UNIQUE";
- /*@innerbreak@*/ break;
+ break;
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
case RPM_INT16_TYPE:
case RPM_INT32_TYPE:
/* case RPM_INT64_TYPE: */
keytype = "int UNIQUE";
- /*@innerbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
keytype = "text UNIQUE";
- /*@innerbreak@*/ break;
+ break;
}
}
if (_debug)
@@ -734,10 +693,8 @@ exit:
* @param flags (unused)
* @return 0 on success
*/
-static int sql_cclose (dbiIndex dbi, /*@only@*/ DBC * dbcursor,
+static int sql_cclose (dbiIndex dbi, DBC * dbcursor,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcursor, fileSystem @*/
{
SCP_t scp = (SCP_t)dbcursor;
int rc;
@@ -758,9 +715,7 @@ enterChroot(dbi);
else
rc = sql_endTransaction(dbi);
-/*@-kepttrans@*/
scp = scpFree(scp);
-/*@=kepttrans@*/
leaveChroot(dbi);
@@ -773,9 +728,7 @@ leaveChroot(dbi);
* @param flags (unused)
* @return 0 on success
*/
-static int sql_close(/*@only@*/ dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
+static int sql_close(dbiIndex dbi, unsigned int flags)
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
int rc = 0;
@@ -809,13 +762,9 @@ leaveChroot(dbi);
* @param rpmtag rpm tag
* @return 0 on success
*/
-static int sql_open(rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ dbiIndex * dbip)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies *dbip, rpmGlobalMacroContext, fileSystem, internalState @*/
+static int sql_open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
{
-/*@-nestedextern -shadow @*/
extern struct _dbiVec sqlitevec;
-/*@=nestedextern -shadow @*/
const char * urlfn = NULL;
const char * root;
@@ -836,12 +785,8 @@ static int sql_open(rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ dbiIndex * dbip)
/*
* Parse db configuration parameters.
*/
- /*@-mods@*/
if ((dbi = db3New(rpmdb, rpmtag)) == NULL)
- /*@-nullstate@*/
return 1;
- /*@=nullstate@*/
- /*@=mods@*/
/*
* Get the prefix/root component and directory path
@@ -866,9 +811,8 @@ enterChroot(dbi);
t = xcalloc(len + 1, sizeof(*t));
(void) stpcpy( t, dbfile );
dbi->dbi_file = t;
-/*@-kepttrans@*/ /* WRONG */
+/* WRONG */
dbi->dbi_subfile = t;
-/*@=kepttrans@*/
}
dbi->dbi_mode=O_RDWR;
@@ -877,9 +821,7 @@ enterChroot(dbi);
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
- /*@-mods@*/
urlfn = rpmGenPath(NULL, home, NULL);
- /*@=mods@*/
(void) urlPath(urlfn, &dbhome);
/*
@@ -938,8 +880,6 @@ leaveChroot(dbi);
* @return 0 on success
*/
static int sql_sync (dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
int rc = 0;
@@ -958,10 +898,8 @@ leaveChroot(dbi);
* @param dbiflags DB_WRITECURSOR or 0
* @return 0 on success
*/
-static int sql_copen (dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
- /*@out@*/ DBC ** dbcp, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *txnid, *dbcp, fileSystem @*/
+static int sql_copen (dbiIndex dbi, DB_TXN * txnid,
+ DBC ** dbcp, unsigned int flags)
{
SCP_t scp = scpNew(dbi->dbi_db);
DBC * dbcursor = (DBC *)scp;
@@ -977,9 +915,9 @@ enterChroot(dbi);
rc = sql_startTransaction(dbi);
if (dbcp)
- /*@-onlytrans@*/ *dbcp = dbcursor; /*@=onlytrans@*/
+ *dbcp = dbcursor;
else
- /*@-kepttrans -nullstate @*/ (void) sql_cclose(dbi, dbcursor, 0); /*@=kepttrans =nullstate @*/
+ (void) sql_cclose(dbi, dbcursor, 0);
leaveChroot(dbi);
@@ -995,12 +933,10 @@ leaveChroot(dbi);
* @param flags (unused)
* @return 0 on success
*/
-static int sql_cdel (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key,
+static int sql_cdel (dbiIndex dbi, DBC * dbcursor, DBT * key,
DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/
{
-/*@i@*/ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
+ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = scpNew(dbi->dbi_db);
int rc = 0;
@@ -1036,12 +972,10 @@ leaveChroot(dbi);
* @param flags (unused)
* @return 0 on success
*/
-static int sql_cget (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key,
+static int sql_cget (dbiIndex dbi, DBC * dbcursor, DBT * key,
DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, dbcursor, *key, *data, fileSystem @*/
{
-/*@i@*/ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
+ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = (SCP_t)dbcursor;
int rc = 0;
int ix;
@@ -1081,11 +1015,11 @@ assert(dbi->dbi_rpmtag == RPMDBI_PACKAGES);
case RPMDBI_PACKAGES:
scp->cmd = sqlite3_mprintf("SELECT key FROM '%q' ORDER BY key;",
dbi->dbi_subfile);
- /*@innerbreak@*/ break;
+ break;
default:
scp->cmd = sqlite3_mprintf("SELECT key FROM '%q';",
dbi->dbi_subfile);
- /*@innerbreak@*/ break;
+ break;
}
rc = sqlite3_prepare(sqldb->db, scp->cmd, strlen(scp->cmd), &scp->pStmt, &scp->pzErrmsg);
if (rc) rpmMessage(RPMMESS_WARNING, "cget(%s) sequential prepare %s (%d)\n", dbi->dbi_subfile, sqlite3_errmsg(sqldb->db), rc);
@@ -1215,12 +1149,10 @@ leaveChroot(dbi);
* @param flags (unused)
* @return 0 on success
*/
-static int sql_cput (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key,
+static int sql_cput (dbiIndex dbi, DBC * dbcursor, DBT * key,
DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/
{
-/*@i@*/ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
+ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = scpNew(dbi->dbi_db);
int rc = 0;
@@ -1258,8 +1190,6 @@ leaveChroot(dbi);
* @return 0 no
*/
static int sql_byteswapped (dbiIndex dbi)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = scpNew(dbi->dbi_db);
@@ -1268,10 +1198,8 @@ static int sql_byteswapped (dbiIndex dbi)
enterChroot(dbi);
-/*@-nullstate@*/
sql_rc = sqlite3_get_table(sqldb->db, "SELECT endian FROM 'db_info';",
&scp->av, &scp->nr, &scp->nc, (char **)&scp->pzErrmsg);
-/*@=nullstate@*/
if (sql_rc == 0 && scp->nr > 0) {
assert(scp->av != NULL);
@@ -1315,7 +1243,6 @@ leaveChroot(dbi);
static int sql_associate (dbiIndex dbi, dbiIndex dbisecondary,
int (*callback) (DB *, const DBT *, const DBT *, DBT *),
unsigned int flags)
- /*@*/
{
if (_debug)
fprintf(stderr, "*** %s:\n", __FUNCTION__);
@@ -1330,10 +1257,8 @@ fprintf(stderr, "*** %s:\n", __FUNCTION__);
* @param flags DB_JOIN_NOSORT or 0
* @return 0 on success
*/
-static int sql_join (dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
+static int sql_join (dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/
{
if (_debug)
fprintf(stderr, "*** %s:\n", __FUNCTION__);
@@ -1348,10 +1273,8 @@ fprintf(stderr, "*** %s:\n", __FUNCTION__);
* @param flags DB_POSITION for same position, 0 for uninitialized
* @return 0 on success
*/
-static int sql_cdup (dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
+static int sql_cdup (dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/
{
if (_debug)
fprintf(stderr, "*** %s:\n", __FUNCTION__);
@@ -1368,10 +1291,8 @@ fprintf(stderr, "*** %s:\n", __FUNCTION__);
* @param flags DB_NEXT, DB_SET, or 0
* @return 0 on success
*/
-static int sql_cpget (dbiIndex dbi, /*@null@*/ DBC * dbcursor,
+static int sql_cpget (dbiIndex dbi, DBC * dbcursor,
DBT * key, DBT * pkey, DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/
{
if (_debug)
fprintf(stderr, "*** %s:\n", __FUNCTION__);
@@ -1386,11 +1307,9 @@ fprintf(stderr, "*** %s:\n", __FUNCTION__);
* @param flags (unused)
* @return 0 on success
*/
-static int sql_ccount (dbiIndex dbi, /*@unused@*/ DBC * dbcursor,
- /*@unused@*/ /*@out@*/ unsigned int * countp,
- /*@unused@*/ unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/
+static int sql_ccount (dbiIndex dbi, DBC * dbcursor,
+ unsigned int * countp,
+ unsigned int flags)
{
if (_debug)
fprintf(stderr, "*** %s:\n", __FUNCTION__);
@@ -1404,10 +1323,8 @@ fprintf(stderr, "*** %s:\n", __FUNCTION__);
* @return 0 on success
*/
static int sql_stat (dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
{
-/*@i@*/ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
+ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = scpNew(dbi->dbi_db);
int rc = 0;
long nkeys = -1;
@@ -1416,15 +1333,11 @@ enterChroot(dbi);
dbi->dbi_stats = _free(dbi->dbi_stats);
-/*@-sizeoftype@*/
dbi->dbi_stats = xcalloc(1, sizeof(DB_HASH_STAT));
-/*@=sizeoftype@*/
scp->cmd = sqlite3_mprintf("SELECT COUNT('key') FROM '%q';", dbi->dbi_subfile);
-/*@-nullstate@*/
rc = sqlite3_get_table(sqldb->db, scp->cmd,
&scp->av, &scp->nr, &scp->nc, (char **)&scp->pzErrmsg);
-/*@=nullstate@*/
if ( rc == 0 && scp->nr > 0) {
assert(scp->av != NULL);
@@ -1456,7 +1369,6 @@ leaveChroot(dbi);
/* cursor_open, cursor_close, cursor_dup, cursor_delete, cursor_get, */
/* cursor_pget?, cursor_put, cursor_count */
/* db_bytewapped, stat */
-/*@observer@*/ /*@unchecked@*/
struct _dbiVec sqlitevec = {
0, 0, 0,
sql_open,
@@ -1476,14 +1388,3 @@ struct _dbiVec sqlitevec = {
sql_stat
};
-/*@=evalorderuncon@*/
-/*@=modfilesystem@*/
-/*@=branchstate@*/
-/*@=compmempass@*/
-/*@=compdef@*/
-/*@=moduncon@*/
-/*@=noeffectuncon@*/
-/*@=globuse@*/
-/*@=paramuse@*/
-/*@=mustmod@*/
-/*@=bounds@*/
diff --git a/rpmdb/tagname.c b/rpmdb/tagname.c
index e92f79e63..8366a8bd0 100644
--- a/rpmdb/tagname.c
+++ b/rpmdb/tagname.c
@@ -8,8 +8,6 @@
#include <rpmio.h>
#include "debug.h"
-/*@access headerTagTableEntry @*/
-/*@access headerTagIndices @*/
/**
* Compare tag table entries by name.
@@ -18,7 +16,6 @@
* @return comparison
*/
static int tagCmpName(const void * avp, const void * bvp)
- /*@*/
{
headerTagTableEntry a = *(headerTagTableEntry *) avp;
headerTagTableEntry b = *(headerTagTableEntry *) bvp;
@@ -32,7 +29,6 @@ static int tagCmpName(const void * avp, const void * bvp)
* @return comparison
*/
static int tagCmpValue(const void * avp, const void * bvp)
- /*@*/
{
headerTagTableEntry a = *(headerTagTableEntry *) avp;
headerTagTableEntry b = *(headerTagTableEntry *) bvp;
@@ -52,20 +48,17 @@ static int tagCmpValue(const void * avp, const void * bvp)
*/
static int tagLoadIndex(headerTagTableEntry ** ipp, int * np,
int (*cmp) (const void * avp, const void * bvp))
- /*@modifies *ipp, *np @*/
{
headerTagTableEntry tte, *ip;
int n = 0;
ip = xcalloc(rpmTagTableSize, sizeof(*ip));
n = 0;
-/*@-dependenttrans@*/ /*@-observertrans@*/ /*@-castexpose@*/ /*@-mods@*/ /*@-modobserver@*/
for (tte = (headerTagTableEntry)rpmTagTable; tte->name != NULL; tte++) {
ip[n] = tte;
n++;
}
assert(n == rpmTagTableSize);
-/*@=dependenttrans@*/ /*@=observertrans@*/ /*@=castexpose@*/ /*@=mods@*/ /*@=modobserver@*/
if (n > 1)
qsort(ip, n, sizeof(*ip), cmp);
@@ -76,24 +69,17 @@ assert(n == rpmTagTableSize);
/* forward refs */
-static const char * _tagName(int tag)
- /*@*/;
-static int _tagType(int tag)
- /*@*/;
-static int _tagValue(const char * tagstr)
- /*@*/;
+static const char * _tagName(int tag);
+static int _tagType(int tag);
+static int _tagValue(const char * tagstr);
-/*@unchecked@*/
static struct headerTagIndices_s _rpmTags = {
tagLoadIndex,
NULL, 0, tagCmpName, _tagValue,
NULL, 0, tagCmpValue, _tagName, _tagType,
};
-/*@-compmempass@*/
-/*@unchecked@*/
headerTagIndices rpmTags = &_rpmTags;
-/*@=compmempass@*/
static const char * _tagName(int tag)
{
@@ -144,7 +130,6 @@ static const char * _tagName(int tag)
strcpy(nameBuf, "(unknown)");
if (_rpmTags.byValue == NULL)
break;
-/*@-boundswrite@*/
l = 0;
u = _rpmTags.byValueSize;
while (l < u) {
@@ -168,14 +153,12 @@ static const char * _tagName(int tag)
strcpy(nameBuf, t->name + (sizeof("RPMTAG_")-1));
for (s = nameBuf+1; *s != '\0'; s++)
*s = xtolower(*s);
- /*@loopbreak@*/ break;
+ break;
}
}
break;
}
-/*@-statictrans@*/
return nameBuf;
-/*@=statictrans@*/
}
static int _tagType(int tag)
@@ -200,7 +183,6 @@ static int _tagType(int tag)
default:
if (_rpmTags.byValue == NULL)
break;
-/*@-boundswrite@*/
l = 0;
u = _rpmTags.byValueSize;
while (l < u) {