]> 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>
Fri, 9 Sep 2011 04:24:26 +0000 (06:24 +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 f231e0e0e54522b99476660b75740f6d06b54969..203c64f512366094b3c3400e3da50fd5aabb263d 100644 (file)
@@ -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;