summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/header.c35
-rw-r--r--lib/header.h8
2 files changed, 35 insertions, 8 deletions
diff --git a/lib/header.c b/lib/header.c
index ff03175e6..c704f8270 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -1774,17 +1774,16 @@ HeaderIterator headerInitIterator(Header h)
return hi;
}
-int headerNextIterator(HeaderIterator hi,
- rpmTag * tag,
- rpmTagType * type,
- rpm_data_t * p,
- rpm_count_t * c)
+int headerNext(HeaderIterator hi, rpmtd td)
{
Header h = hi->h;
int slot = hi->next_index;
indexEntry entry = NULL;
int rc;
+ assert(td != NULL);
+ rpmtdReset(td);
+
for (slot = hi->next_index; slot < h->indexUsed; slot++) {
entry = h->index + slot;
if (!ENTRY_IS_REGION(entry))
@@ -1797,15 +1796,35 @@ int headerNextIterator(HeaderIterator hi,
/* LCL: no clue */
hi->next_index++;
- if (tag)
- *tag = entry->info.tag;
+ td->tag = entry->info.tag;
- rc = copyEntry(entry, type, p, c, 0);
+ rc = copyTdEntry(entry, td, 0);
/* XXX 1 on success */
return ((rc == 1) ? 1 : 0);
}
+int headerNextIterator(HeaderIterator hi,
+ rpmTag * tag,
+ rpmTagType * type,
+ rpm_data_t * p,
+ rpm_count_t * c)
+{
+ struct rpmtd_s td;
+ int rc;
+
+ rc = headerNext(hi, &td);
+ if (tag)
+ *tag = td.tag;
+ if (type)
+ *type = td.type;
+ if (p)
+ *p = td.data;
+ if (c)
+ *c = td.count;
+ return rc;
+}
+
/** \ingroup header
* Duplicate a header.
* @param h header
diff --git a/lib/header.h b/lib/header.h
index f8eda86b3..494ec94fa 100644
--- a/lib/header.h
+++ b/lib/header.h
@@ -471,6 +471,14 @@ HeaderIterator headerInitIterator(Header h);
/** \ingroup header
* Return next tag from header.
* @param hi header tag iterator
+ * @retval td tag data container
+ * @return 1 on success, 0 on failure
+ */
+int headerNext(HeaderIterator hi, rpmtd td);
+
+/** \ingroup header
+ * Return next tag from header.
+ * @param hi header tag iterator
* @retval *tag tag
* @retval *type tag value data type
* @retval *p pointer to tag value(s)