summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/header.c6
-rw-r--r--lib/header.h7
-rw-r--r--lib/header_internal.h1
-rw-r--r--lib/rpmdb.c1
4 files changed, 15 insertions, 0 deletions
diff --git a/lib/header.c b/lib/header.c
index fa38c89f9..78b4f89fb 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -141,6 +141,7 @@ Header headerNew(void)
h->blob = NULL;
h->indexAlloced = INDEX_MALLOC_SIZE;
h->indexUsed = 0;
+ h->instance = 0;
h->flags |= HEADERFLAG_SORTED;
h->index = (h->indexAlloced
@@ -861,6 +862,7 @@ Header headerLoad(void * uh)
h->blob = uh;
h->indexAlloced = il + 1;
h->indexUsed = il;
+ h->instance = 0;
h->index = xcalloc(h->indexAlloced, sizeof(*h->index));
h->flags |= HEADERFLAG_SORTED;
h->nrefs = 0;
@@ -1953,3 +1955,7 @@ void headerCopyTags(Header headerFrom, Header headerTo,
}
}
+unsigned int headerGetInstance(Header h)
+{
+ return h ? h->instance : 0;
+}
diff --git a/lib/header.h b/lib/header.h
index 357accd7d..aa93e2291 100644
--- a/lib/header.h
+++ b/lib/header.h
@@ -369,6 +369,13 @@ rpm_color_t headerGetColor(Header h);
*/
int headerIsSource(Header h);
+/** \ingroup header
+ * Return header instance, ie is the header from rpmdb.
+ * @param h header
+ * @return rpmdb record number or 0
+ */
+unsigned int headerGetInstance(Header h);
+
typedef enum headerConvOps_e {
HEADERCONV_EXPANDFILELIST = 0,
HEADERCONV_COMPRESSFILELIST = 1,
diff --git a/lib/header_internal.h b/lib/header_internal.h
index f41389119..6139a4a06 100644
--- a/lib/header_internal.h
+++ b/lib/header_internal.h
@@ -54,6 +54,7 @@ struct headerToken_s {
indexEntry index; /*!< Array of tags. */
int indexUsed; /*!< Current size of tag array. */
int indexAlloced; /*!< Allocated size of tag array. */
+ unsigned int instance; /*!< Rpmdb instance (offset) */
int flags;
#define HEADERFLAG_SORTED (1 << 0) /*!< Are header entries sorted? */
#define HEADERFLAG_ALLOCATED (1 << 1) /*!< Is 1st header region allocated? */
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index 78a97b21e..118d0703e 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -2082,6 +2082,7 @@ top:
goto top;
return NULL;
}
+ mi->mi_h->instance = mi->mi_offset;
mi->mi_prevoffset = mi->mi_offset;
mi->mi_modified = 0;