From cab09c6c36ddeec4da6f0f557afcd2028b38fa03 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 31 Aug 2011 11:09:03 +0300 Subject: [PATCH] Remember ds color (if set) through rpmdsCurrent() - Currently only dependency sets coming from transaction elements get colored, only bother allocating memory for non-zero color. --- lib/rpmds.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/rpmds.c b/lib/rpmds.c index a62bb8d..af7732e 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -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; } -- 2.7.4