Convert headerCopy() to use the new interfaces internally
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 13 May 2008 10:25:14 +0000 (13:25 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 13 May 2008 10:25:14 +0000 (13:25 +0300)
lib/header.c

index b951328..a6c81a6 100644 (file)
@@ -1841,16 +1841,14 @@ Header headerCopy(Header h)
 {
     Header nh = headerNew();
     HeaderIterator hi;
-    rpmTagType type;
-    rpmTag tag;
-    rpm_count_t count;
-    rpm_data_t ptr;
+    struct rpmtd_s td;
    
-    for (hi = headerInitIterator(h);
-       headerNextIterator(hi, &tag, &type, &ptr, &count);
-       ptr = headerFreeData(ptr, type))
-    {
-       if (ptr) (void) headerAddEntry(nh, tag, type, ptr, count);
+    hi = headerInitIterator(h);
+    while (headerNext(hi, &td)) {
+       if (rpmtdCount(&td) > 0) {
+           (void) headerPut(nh, &td, HEADERPUT_DEFAULT);
+       }
+       rpmtdFreeData(&td);
     }
     hi = headerFreeIterator(hi);