- tag container isn't that big a win on add/append operations as it is on
retrieval, just use the existing headerAddEntry() family to do the
actual work
- headerPut() is a nice and short name, lifted from rpm5.org, API might
differ
- flags to control operation, just whether append is permitted or not for now
: headerAddEntry(h, tag, type, p, c));
}
+int headerPut(Header h, rpmtd td, int flags)
+{
+ int rc;
+
+ assert(td != NULL);
+ if (flags & HEADERPUT_APPEND) {
+ rc = headerAddOrAppendEntry(h, td->tag, td->type, td->data, td->count);
+ } else {
+ rc = headerAddEntry(h, td->tag, td->type, td->data, td->count);
+ }
+ return rc;
+}
+
int headerAddI18NString(Header h, rpmTag tag, const char * string,
const char * lang)
{
rpm_data_t * p,
rpm_count_t * c);
+enum headerPutFlags_e {
+ HEADERPUT_DEFAULT = 0,
+ HEADERPUT_APPEND = (1 << 0),
+};
+/** \ingroup header
+ * Add or append tag to header.
+ *
+ * @param h header
+ * @param td tag data container
+ * @param flags flags to control operation
+ * @return 1 on success, 0 on failure
+ */
+int headerPut(Header h, rpmtd td, int flags);
+
/** \ingroup header
* Add tag to header.
* Duplicate tags are okay, but only defined for iteration (with the