summaryrefslogtreecommitdiffstats
path: root/sys-utils/lscpu.c
diff options
context:
space:
mode:
authorHeiko Carstens2011-09-06 02:52:54 +0200
committerKarel Zak2011-09-09 06:24:26 +0200
commitf6512068b2d0d424dc5aa125c0ba2fe411acd305 (patch)
tree6deaad7dd9290a5b9cbd6db7c469bb9967489fd8 /sys-utils/lscpu.c
parentlscpu: fix cache output for extended parsable output (diff)
downloadkernel-qcow2-util-linux-f6512068b2d0d424dc5aa125c0ba2fe411acd305.tar.gz
kernel-qcow2-util-linux-f6512068b2d0d424dc5aa125c0ba2fe411acd305.tar.xz
kernel-qcow2-util-linux-f6512068b2d0d424dc5aa125c0ba2fe411acd305.zip
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 <heiko.carstens@de.ibm.com>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r--sys-utils/lscpu.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index f231e0e0e..203c64f51 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;