diff options
author | jbj <devnull@localhost> | 2002-07-04 21:08:05 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-07-04 21:08:05 +0000 |
commit | 6dca216517ffb04f30d84ce1d1335efc37e7736d (patch) | |
tree | 0321a51a42d454fb20473111111ea4d983c061ea /rpmdb | |
parent | af3c677f06687e5ad1e33eb24f984c7ac5ff2a33 (diff) | |
download | librpm-tizen-6dca216517ffb04f30d84ce1d1335efc37e7736d.tar.gz librpm-tizen-6dca216517ffb04f30d84ce1d1335efc37e7736d.tar.bz2 librpm-tizen-6dca216517ffb04f30d84ce1d1335efc37e7736d.zip |
- fix: forgot lazy open of database on --freshen path (#67907).
- proof-of-concept rpmcache functionality.
CVS patchset: 5539
CVS date: 2002/07/04 21:08:05
Diffstat (limited to 'rpmdb')
-rw-r--r-- | rpmdb/rpmdb.c | 15 | ||||
-rw-r--r-- | rpmdb/rpmdb.h | 8 |
2 files changed, 9 insertions, 14 deletions
diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index abb5662fa..e37a4da82 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -1458,21 +1458,15 @@ rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi) } unsigned int rpmdbGetIteratorOffset(rpmdbMatchIterator mi) { - if (mi == NULL) - return 0; - return mi->mi_offset; + return (mi ? mi->mi_offset : 0); } unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi) { - if (mi == NULL) - return 0; - return mi->mi_filenum; + return (mi ? mi->mi_filenum : 0); } int rpmdbGetIteratorCount(rpmdbMatchIterator mi) { - if (!(mi && mi->mi_set)) - return 0; /* XXX W2DO? */ - return mi->mi_set->count; + return (mi && mi->mi_set ? mi->mi_set->count : 0); } /** @@ -2216,6 +2210,7 @@ if (rc == 0) mi->mi_filenum = 0; mi->mi_nre = 0; mi->mi_re = NULL; + /*@-nullret@*/ /* FIX: mi->mi_{keyp,dbc,set,re->preg} are NULL */ return mi; /*@=nullret@*/ @@ -2729,6 +2724,7 @@ data->size = 0; dbiIndexSet set; int stringvalued; byte bin[32]; + byte * t; /* * Include the tagNum in all indices. rpm-3.0.4 and earlier @@ -2792,7 +2788,6 @@ data->size = 0; /* Convert from hex to binary. */ if (dbi->dbi_rpmtag == RPMTAG_FILEMD5S) { const char * s; - byte * t; s = rpmvals[i]; t = bin; diff --git a/rpmdb/rpmdb.h b/rpmdb/rpmdb.h index 459636635..cf2353550 100644 --- a/rpmdb/rpmdb.h +++ b/rpmdb/rpmdb.h @@ -543,7 +543,7 @@ int dbiDel(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data, /*@globals fileSystem @*/ /*@modifies *dbcursor, fileSystem @*/ { - assert(key->size > 0); + assert(key->data != NULL && key->size > 0); return (dbi->dbi_vec->cdel) (dbi, dbcursor, key, data, flags); } @@ -562,7 +562,7 @@ int dbiGet(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data, /*@globals fileSystem @*/ /*@modifies *dbcursor, *key, *data, fileSystem @*/ { - assert((flags == DB_NEXT) || key->size > 0); + assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0)); return (dbi->dbi_vec->cget) (dbi, dbcursor, key, data, flags); } @@ -582,7 +582,7 @@ int dbiPget(dbiIndex dbi, /*@null@*/ DBC * dbcursor, /*@globals fileSystem @*/ /*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/ { - assert((flags == DB_NEXT) || key->size > 0); + assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0)); return (dbi->dbi_vec->cpget) (dbi, dbcursor, key, pkey, data, flags); } @@ -601,7 +601,7 @@ int dbiPut(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data, /*@globals fileSystem @*/ /*@modifies *dbcursor, *key, fileSystem @*/ { - assert(key->size > 0); + assert(key->data != NULL && key->size > 0 && data->data != NULL && data->size > 0); return (dbi->dbi_vec->cput) (dbi, dbcursor, key, data, flags); } |