]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: differentiate between infos[] and columns[]
authorKarel Zak <kzak@redhat.com>
Thu, 17 Jul 2014 13:35:52 +0000 (15:35 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 18 Jul 2014 11:45:32 +0000 (13:45 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsblk.c

index 688ee6dea4ac37768dbfde27a581951ec2acfb7e..bdd28a29f613ddbe0fd5e264fb10d997f7427d8d 100644 (file)
@@ -296,7 +296,7 @@ static int column_name_to_id(const char *name, size_t namesz)
 {
        size_t i;
 
-       for (i = 0; i < NCOLS; i++) {
+       for (i = 0; i < ARRAY_SIZE(infos); i++) {
                const char *cn = infos[i].name;
 
                if (!strncasecmp(name, cn, namesz) && !*(cn + namesz))
@@ -1494,7 +1494,7 @@ static void __attribute__((__noreturn__)) help(FILE *out)
 
        fprintf(out, _("\nAvailable columns (for --output):\n"));
 
-       for (i = 0; i < NCOLS; i++)
+       for (i = 0; i < ARRAY_SIZE(infos); i++)
                fprintf(out, " %11s  %s\n", infos[i].name, _(infos[i].help));
 
        fprintf(out, USAGE_MAN_TAIL("lsblk(8)"));
@@ -1599,7 +1599,7 @@ int main(int argc, char *argv[])
                        outarg = optarg;
                        break;
                case 'O':
-                       for (ncolumns = 0 ; ncolumns < (int) NCOLS; ncolumns++)
+                       for (ncolumns = 0 ; ncolumns < (int) ARRAY_SIZE(infos); ncolumns++)
                                columns[ncolumns] = ncolumns;
                        break;
                case 'p':