Remember ds color (if set) through rpmdsCurrent()
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 31 Aug 2011 08:09:03 +0000 (11:09 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 31 Aug 2011 08:09:03 +0000 (11:09 +0300)
- Currently only dependency sets coming from transaction elements
  get colored, only bother allocating memory for non-zero color.

lib/rpmds.c

index a62bb8d..af7732e 100644 (file)
@@ -209,7 +209,8 @@ char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds)
 }
 
 static rpmds singleDS(rpmTagVal tagN, const char * N, const char * EVR,
-                     rpmsenseFlags Flags, unsigned int instance)
+                     rpmsenseFlags Flags, unsigned int instance,
+                     rpm_color_t Color)
 {
     rpmds ds = NULL;
     const char * Type;
@@ -230,6 +231,8 @@ static rpmds singleDS(rpmTagVal tagN, const char * N, const char * EVR,
     ds->Flags = xmalloc(sizeof(*ds->Flags));
     ds->Flags[0] = Flags;
     ds->i = 0;
+    if (Color)
+       rpmdsSetColor(ds, Color);
 
 exit:
     return rpmdsLink(ds);
@@ -239,14 +242,14 @@ rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags)
 {
     char *evr = headerGetAsString(h, RPMTAG_EVR);
     rpmds ds = singleDS(tagN, headerGetString(h, RPMTAG_NAME),
-                       evr, Flags, headerGetInstance(h));
+                       evr, Flags, headerGetInstance(h), 0);
     free(evr);
     return ds;
 }
 
 rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags)
 {
-    return singleDS(tagN, N, EVR, Flags, 0);
+    return singleDS(tagN, N, EVR, Flags, 0, 0);
 }
 
 rpmds rpmdsCurrent(rpmds ds)
@@ -254,7 +257,7 @@ rpmds rpmdsCurrent(rpmds ds)
     rpmds cds = NULL;
     if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
        cds = singleDS(ds->tagN, ds->N[ds->i], ds->EVR[ds->i],
-                      ds->Flags[ds->i], ds->instance);
+                      ds->Flags[ds->i], ds->instance, rpmdsColor(ds));
     }
     return cds;
 }