summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2023-03-22 09:43:17 +0200
committerPanu Matilainen <pmatilai@redhat.com>2023-03-22 11:17:45 +0200
commita0dcb68b062c90cc0aed26d2f3a222d0d3341635 (patch)
treef2e7c06e240022444f29089b9e39f12b07ac58c5 /lib
parent0f957330f24cdb2510e0bbdface54ffa8064b8ce (diff)
downloadrpm-a0dcb68b062c90cc0aed26d2f3a222d0d3341635.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/rpmte.c16
1 files changed, 2 insertions, 14 deletions
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. */