From a0dcb68b062c90cc0aed26d2f3a222d0d3341635 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 22 Mar 2023 09:43:17 +0200 Subject: Clean up rpmteColorDS(), support all dependency types Take advantage of rpmdsD() instead of doing it all manually. As an extra bonus it now supports coloring from all dependency types, although we only ever call it with requires and provides currently. --- lib/rpmte.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/rpmte.c b/lib/rpmte.c index 6a6201575..2f607683d 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -490,7 +490,7 @@ static void rpmteColorDS(rpmte te, rpmTag tag) { rpmfi fi; rpmds ds = rpmteDS(te, tag); - char deptype = 'R'; + char deptype = rpmdsD(ds); char mydt; const uint32_t * ddict; rpm_color_t * colors; @@ -499,21 +499,9 @@ static void rpmteColorDS(rpmte te, rpmTag tag) unsigned ix; int ndx, i; - if (!(te && (Count = rpmdsCount(ds)) > 0 && rpmfilesFC(te->files) > 0)) + if (!(te && deptype && (Count = rpmdsCount(ds)) > 0 && rpmfilesFC(te->files) > 0)) return; - switch (tag) { - default: - return; - break; - case RPMTAG_PROVIDENAME: - deptype = 'P'; - break; - case RPMTAG_REQUIRENAME: - deptype = 'R'; - break; - } - colors = xcalloc(Count, sizeof(*colors)); /* Calculate dependency color. */ -- cgit v1.2.1