Convert headerGetColor() to use new headerGet() interface
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 14 May 2008 06:31:24 +0000 (09:31 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 14 May 2008 06:31:24 +0000 (09:31 +0300)
lib/hdrNVR.c

index 0238f98..a8c2f3f 100644 (file)
@@ -104,19 +104,13 @@ char * headerGetEVR(Header h, const char ** np)
 
 rpm_color_t headerGetColor(Header h)
 {
-    HGE_t hge = (HGE_t)headerGetEntryMinMemory;
     rpm_color_t hcolor = 0;
-    rpm_color_t * fcolors;
-    rpm_count_t ncolors;
-    int i;
-
-    fcolors = NULL;
-    ncolors = 0;
-    if (hge(h, RPMTAG_FILECOLORS, NULL, (rpm_data_t *)&fcolors, &ncolors)
-     && fcolors != NULL && ncolors > 0)
-    {
-       for (i = 0; i < ncolors; i++)
-           hcolor |= fcolors[i];
+    struct rpmtd_s fcolors;
+
+    headerGet(h, RPMTAG_FILECOLORS, &fcolors, HEADERGET_MINMEM);
+    while (rpmtdNext(&fcolors) >= 0) {
+       rpm_color_t *fcolor = rpmtdGetUint32(&fcolors);
+       hcolor |= *fcolor;
     }
     hcolor &= 0x0f;