]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: simplify cache column output function
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 6 Sep 2011 00:52:54 +0000 (02:52 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 18 Oct 2011 12:22:26 +0000 (14:22 +0200)
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>
sys-utils/lscpu.c

index 8326b10815edc8a2bffd810602ad051e8b02e011..607e062f22dd44680f551bc4f165810b77a19370 100644 (file)
@@ -823,13 +823,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;