From f6512068b2d0d424dc5aa125c0ba2fe411acd305 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Tue, 6 Sep 2011 02:52:54 +0200 Subject: [PATCH] lscpu: simplify cache column output function Simplify the logic to "always print a ',' for each cache except if it is the last one. This is also a preparation patch for printing the cache column for offline CPUs where it would print one colon too much because of the current logic. Signed-off-by: Heiko Carstens --- sys-utils/lscpu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index f231e0e0e5..203c64f512 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -915,13 +915,11 @@ print_parsable_cell(struct lscpu_desc *desc, int i, int col, int compatible) for (x = 0; x < ca->nsharedmaps; x++) { if (CPU_ISSET_S(i, setsize, ca->sharedmaps[x])) { - if (j != desc->ncaches - 1) - putchar(compatible ? ',' : ':'); printf("%d", x); break; } } - if (x == ca->nsharedmaps) + if (j != 0) putchar(compatible ? ',' : ':'); } break; -- 2.47.3