From: Heiko Carstens Date: Tue, 6 Sep 2011 00:52:54 +0000 (+0200) Subject: lscpu: simplify cache column output function X-Git-Tag: v2.21-rc1~452 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6512068b2d0d424dc5aa125c0ba2fe411acd305;p=thirdparty%2Futil-linux.git 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 --- 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;