summaryrefslogtreecommitdiff
path: root/rpmdb
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-07-13 19:08:51 +0000
committerjbj <devnull@localhost>2002-07-13 19:08:51 +0000
commit261b4a2ecbc7b4ccef094490c74e90f8cfdacfff (patch)
tree16df21598d84a9ba57f8b5accd422c75607c980f /rpmdb
parentb9df0c51e490b2a2e158a8525d7753cb1fe1bc6e (diff)
downloadrpm-261b4a2ecbc7b4ccef094490c74e90f8cfdacfff.tar.gz
rpm-261b4a2ecbc7b4ccef094490c74e90f8cfdacfff.tar.bz2
rpm-261b4a2ecbc7b4ccef094490c74e90f8cfdacfff.zip
- install rpmal.h and rpmhash.h, implicit rpmps.hinclude, for now.
- revert headerFree/headerLink/headerUnlink debugging. CVS patchset: 5550 CVS date: 2002/07/13 19:08:51
Diffstat (limited to 'rpmdb')
-rw-r--r--rpmdb/Makefile.am4
-rw-r--r--rpmdb/hdrinline.h27
-rw-r--r--rpmdb/header.c46
-rw-r--r--rpmdb/header.h19
-rw-r--r--rpmdb/rpmdb.c38
-rw-r--r--rpmdb/rpmdb.h10
6 files changed, 72 insertions, 72 deletions
diff --git a/rpmdb/Makefile.am b/rpmdb/Makefile.am
index 0dc40b7ce..90f7f7fb3 100644
--- a/rpmdb/Makefile.am
+++ b/rpmdb/Makefile.am
@@ -20,8 +20,8 @@ tjfn_LDFLAGS = -all-static
tjfn_LDADD = librpmdb.la
pkgincdir = $(pkgincludedir)
-pkginc_HEADERS = db.h header.h hdrinline.h rpmdb.h
-noinst_HEADERS = fprint.h header_internal.h legacy.h rpmhash.h
+pkginc_HEADERS = db.h header.h hdrinline.h rpmdb.h rpmhash.h
+noinst_HEADERS = fprint.h header_internal.h legacy.h
mylibpaths = \
-L$(top_builddir)/lib \
diff --git a/rpmdb/hdrinline.h b/rpmdb/hdrinline.h
index ebfb5164e..8a8637632 100644
--- a/rpmdb/hdrinline.h
+++ b/rpmdb/hdrinline.h
@@ -40,59 +40,44 @@ Header headerNew(void)
/** \ingroup header
* Dereference a header instance.
- * @todo Remove debugging entry from the ABI.
* @param h header
- * @param msg
- * @param fn
- * @param ln
* @return NULL always
*/
/*@unused@*/ static inline
-/*@null@*/ Header XheaderFree( /*@killref@*/ /*@null@*/ Header h,
- /*@null@*/ const char * msg, const char * fn, unsigned ln)
+/*@null@*/ Header headerFree( /*@killref@*/ /*@null@*/ Header h)
/*@modifies h @*/
{
/*@-abstract@*/
if (h == NULL) return NULL;
/*@=abstract@*/
- return (h2hv(h)->Xhdrfree) (h, msg, fn, ln);
+ return (h2hv(h)->hdrfree) (h);
}
/** \ingroup header
* Reference a header instance.
- * @todo Remove debugging entry from the ABI.
* @param h header
- * @param msg
- * @param fn
- * @param ln
* @return new header reference
*/
/*@unused@*/ static inline
-Header XheaderLink(Header h, /*@null@*/ const char * msg,
- const char * fn, unsigned ln)
+Header headerLink(Header h)
/*@modifies h @*/
{
- return (h2hv(h)->Xhdrlink) (h, msg, fn, ln);
+ return (h2hv(h)->hdrlink) (h);
}
/** \ingroup header
* Dereference a header instance.
- * @todo Remove debugging entry from the ABI.
* @param h header
- * @param msg
- * @param fn
- * @param ln
* @return new header reference
*/
/*@unused@*/ static inline
-Header XheaderUnlink(/*@killref@*/ /*@null@*/ Header h,
- /*@null@*/ const char * msg, const char * fn, unsigned ln)
+Header headerUnlink(/*@killref@*/ /*@null@*/ Header h)
/*@modifies h @*/
{
/*@-abstract@*/
if (h == NULL) return NULL;
/*@=abstract@*/
- return (h2hv(h)->Xhdrunlink) (h, msg, fn, ln);
+ return (h2hv(h)->hdrunlink) (h);
}
/*@-exportlocal@*/
diff --git a/rpmdb/header.c b/rpmdb/header.c
index bd4428710..7ac19cf0c 100644
--- a/rpmdb/header.c
+++ b/rpmdb/header.c
@@ -98,19 +98,11 @@ _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies *p @*/
* @return referenced header instance
*/
static
-Header XheaderLink(Header h, /*@null@*/ const char * msg,
- const char * fn, unsigned ln)
+Header headerLink(Header h)
/*@modifies h @*/
{
-/*@-nullret@*/
- if (h == NULL) return NULL;
-/*@=nullret@*/
-
- h->nrefs++;
-/*@-modfilesystem@*/
-if ((_h_debug > 0 || (h->flags & HEADERFLAG_DEBUG)) && msg != NULL)
-fprintf(stderr, "--> h %p ++ %d blob %p flags %x %s at %s:%u\n", h, h->nrefs, h->blob, h->flags, msg, fn, ln);
-/*@=modfilesystem@*/
+ if (h != NULL)
+ h->nrefs++;
/*@-refcounttrans @*/
return h;
/*@=refcounttrans @*/
@@ -122,16 +114,11 @@ fprintf(stderr, "--> h %p ++ %d blob %p flags %x %s at %s:%u\n", h, h->nrefs, h
* @return NULL always
*/
static /*@null@*/
-Header XheaderUnlink(/*@killref@*/ /*@null@*/ Header h,
- /*@null@*/ const char * msg, const char * fn, unsigned ln)
+Header headerUnlink(/*@killref@*/ /*@null@*/ Header h)
/*@modifies h @*/
{
- if (h == NULL) return NULL;
-/*@-modfilesystem@*/
-if ((_h_debug > 0 || (h->flags & HEADERFLAG_DEBUG)) && msg != NULL)
-fprintf(stderr, "--> h %p -- %d blob %p flags %x %s at %s:%u\n", h, h->nrefs, h->blob, h->flags, msg, fn, ln);
-/*@=modfilesystem@*/
- h->nrefs--;
+ if (h)
+ h->nrefs--;
return NULL;
}
@@ -141,11 +128,10 @@ fprintf(stderr, "--> h %p -- %d blob %p flags %x %s at %s:%u\n", h, h->nrefs, h
* @return NULL always
*/
static /*@null@*/
-Header XheaderFree(/*@killref@*/ /*@null@*/ Header h,
- /*@null@*/ const char * msg, const char * fn, unsigned ln)
+Header headerFree(/*@killref@*/ /*@null@*/ Header h)
/*@modifies h @*/
{
- (void) XheaderUnlink(h, msg, fn, ln);
+ (void) headerUnlink(h);
/*@-usereleased@*/
if (h == NULL || h->nrefs > 0)
@@ -200,7 +186,7 @@ Header headerNew(void)
h->nrefs = 0;
/*@-globstate -observertrans @*/
- return headerLink(h, "headerNew");
+ return headerLink(h);
/*@=globstate =observertrans @*/
}
@@ -960,7 +946,7 @@ Header headerLoad(/*@kept@*/ void * uh)
h->index = xcalloc(h->indexAlloced, sizeof(*h->index));
h->flags |= HEADERFLAG_SORTED;
h->nrefs = 0;
- h = headerLink(h, "headerLoad");
+ h = headerLink(h);
/*
* XXX XFree86-libs, ash, and pdksh from Red Hat 5.2 have bogus
@@ -1116,7 +1102,7 @@ Header headerReload(/*@only@*/ Header h, int tag)
void * uh = doHeaderUnload(h, &length);
/*@=boundswrite@*/
- h = headerFree(h, "headerReload");
+ h = headerFree(h);
/*@=onlytrans@*/
if (uh == NULL)
return NULL;
@@ -3330,7 +3316,7 @@ static /*@null@*/
HeaderIterator headerFreeIterator(/*@only@*/ HeaderIterator hi)
/*@modifies hi @*/
{
- hi->h = headerFree(hi->h, "Iterator");
+ hi->h = headerFree(hi->h);
hi = _free(hi);
return hi;
}
@@ -3348,7 +3334,7 @@ HeaderIterator headerInitIterator(Header h)
headerSort(h);
- hi->h = headerLink(h, "Iterator");
+ hi->h = headerLink(h);
hi->next_index = 0;
return hi;
}
@@ -3427,9 +3413,9 @@ Header headerCopy(Header h)
/*@observer@*/ /*@unchecked@*/
static struct HV_s hdrVec1 = {
- XheaderLink,
- XheaderUnlink,
- XheaderFree,
+ headerLink,
+ headerUnlink,
+ headerFree,
headerNew,
headerSort,
headerUnsort,
diff --git a/rpmdb/header.h b/rpmdb/header.h
index 086b8bc56..a3f69a4dc 100644
--- a/rpmdb/header.h
+++ b/rpmdb/header.h
@@ -306,8 +306,7 @@ Header (*HDRnew) (void)
* @return NULL always
*/
typedef
-/*@null@*/ Header (*HDRfree) (/*@killref@*/ /*@null@*/ Header h,
- /*@null@*/ const char * msg, const char * fn, unsigned ln)
+/*@null@*/ Header (*HDRfree) (/*@killref@*/ /*@null@*/ Header h)
/*@modifies h @*/;
/** \ingroup header
@@ -316,8 +315,7 @@ typedef
* @return referenced header instance
*/
typedef
-Header (*HDRlink) (Header h, /*@null@*/ const char * msg,
- const char * fn, unsigned ln)
+Header (*HDRlink) (Header h)
/*@modifies h @*/;
/** \ingroup header
@@ -326,8 +324,7 @@ Header (*HDRlink) (Header h, /*@null@*/ const char * msg,
* @return NULL always
*/
typedef
-Header (*HDRunlink) (/*@killref@*/ /*@null@*/ Header h,
- /*@null@*/ const char * msg, const char * fn, unsigned ln)
+Header (*HDRunlink) (/*@killref@*/ /*@null@*/ Header h)
/*@modifies h @*/;
/** \ingroup header
@@ -658,9 +655,9 @@ int (*HDRnextiter) (HeaderIterator hi,
*/
typedef /*@abstract@*/ struct HV_s * HV_t;
struct HV_s {
- HDRlink Xhdrlink;
- HDRunlink Xhdrunlink;
- HDRfree Xhdrfree;
+ HDRlink hdrlink;
+ HDRunlink hdrunlink;
+ HDRfree hdrfree;
HDRnew hdrnew;
HDRsort hdrsort;
HDRunsort hdrunsort;
@@ -719,10 +716,6 @@ void * headerFreeData( /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
return NULL;
}
-#define headerLink(_h, _msg) XheaderLink(_h, _msg, __FILE__, __LINE__)
-#define headerUnlink(_h, _msg) XheaderUnlink(_h, _msg, __FILE__, __LINE__)
-#define headerFree(_h, _msg) XheaderFree(_h, _msg, __FILE__, __LINE__)
-
#if !defined(__HEADER_PROTOTYPES__)
#include <hdrinline.h>
#endif
diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c
index 24beaa7fa..20db5d9f1 100644
--- a/rpmdb/rpmdb.c
+++ b/rpmdb/rpmdb.c
@@ -624,6 +624,32 @@ int rpmdbOpenAll(rpmdb db)
return rc;
}
+int rpmdbCloseDBI(rpmdb db, int rpmtag)
+{
+ int dbix;
+ int rc = 0;
+
+ if (db == NULL || db->_dbi == NULL || dbiTags == NULL)
+ return 0;
+
+ for (dbix = 0; dbix < dbiTagsMax; dbix++) {
+ if (dbiTags[dbix] != rpmtag)
+ continue;
+/*@-boundswrite@*/
+ if (db->_dbi[dbix] != NULL) {
+ int xx;
+ /*@-unqualifiedtrans@*/ /* 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 */
int rpmdbClose(rpmdb db)
{
@@ -1033,7 +1059,7 @@ if (rc == 0)
mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, &offset, sizeof(offset));
h = rpmdbNextIterator(mi);
if (h)
- h = headerLink(h, "rpmdbFindByFile");
+ h = headerLink(h);
mi = rpmdbFreeIterator(mi);
}
@@ -1067,7 +1093,7 @@ if (rc == 0)
baseNames = hfd(baseNames, bnt);
dirNames = hfd(dirNames, dnt);
- h = headerFree(h, "rpmdbFindByFile");
+ h = headerFree(h);
}
rec = _free(rec);
@@ -1404,7 +1430,7 @@ static int miFreeHeader(rpmdbMatchIterator mi, dbiIndex dbi)
data->size = 0;
}
- mi->mi_h = headerFree(mi->mi_h, "mi->mi_h");
+ mi->mi_h = headerFree(mi->mi_h);
/*@-nullstate@*/
return rc;
@@ -2245,7 +2271,7 @@ memset(data, 0, sizeof(*data));
mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, &hdrNum, sizeof(hdrNum));
h = rpmdbNextIterator(mi);
if (h)
- h = headerLink(h, "rpmdbRemove");
+ h = headerLink(h);
mi = rpmdbFreeIterator(mi);
}
@@ -2520,7 +2546,7 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
(void) unblockSignals(db, &signalMask);
- h = headerFree(h, "rpmdbRemove");
+ h = headerFree(h);
/* XXX return ret; */
return 0;
@@ -3403,7 +3429,7 @@ int rpmdbRebuild(const char * prefix)
{ Header nh = (headerIsEntry(h, RPMTAG_HEADERIMAGE)
? headerCopy(h) : NULL);
rc = rpmdbAdd(newdb, -1, (nh ? nh : h));
- nh = headerFree(nh, "rpmdbRebuild");
+ nh = headerFree(nh);
}
if (rc) {
diff --git a/rpmdb/rpmdb.h b/rpmdb/rpmdb.h
index cdf7fd29a..1f8d15ea3 100644
--- a/rpmdb/rpmdb.h
+++ b/rpmdb/rpmdb.h
@@ -837,6 +837,16 @@ int rpmdbVerify(/*@null@*/ const char * prefix)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
+/**
+ * Close a single database index.
+ * @param db rpm database
+ * @param rpmtag rpm tag
+ * @return 0 on success
+ */
+int rpmdbCloseDBI(/*@null@*/ rpmdb db, int rpmtag)
+ /*@globals fileSystem @*/
+ /*@modifies db, fileSystem @*/;
+
/** \ingroup rpmdb
* Close all database indices and free rpmdb.
* @param db rpm database