Convert headerGetColor() to use per-datatype iterator
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 21 May 2008 11:51:25 +0000 (14:51 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 21 May 2008 11:51:25 +0000 (14:51 +0300)
lib/hdrNVR.c

index a8c2f3f..68ab7e2 100644 (file)
@@ -104,12 +104,11 @@ char * headerGetEVR(Header h, const char ** np)
 
 rpm_color_t headerGetColor(Header h)
 {
-    rpm_color_t hcolor = 0;
+    rpm_color_t hcolor = 0, *fcolor;
     struct rpmtd_s fcolors;
 
     headerGet(h, RPMTAG_FILECOLORS, &fcolors, HEADERGET_MINMEM);
-    while (rpmtdNext(&fcolors) >= 0) {
-       rpm_color_t *fcolor = rpmtdGetUint32(&fcolors);
+    while ((fcolor = rpmtdNextUint32(&fcolors)) != NULL) {
        hcolor |= *fcolor;
     }
     hcolor &= 0x0f;