Whamcloud - gitweb
LU-6210 utils: Use C99 initializers in lfs_changelog() 22/27522/3
authorSteve Guminski <stephenx.guminski@intel.com>
Fri, 14 Apr 2017 19:33:23 +0000 (15:33 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 28 Aug 2017 06:26:32 +0000 (06:26 +0000)
This patch makes no functional changes.  Struct initializers that
use C89 or GCC-only syntax are updated to C99 syntax.  Variables of
type struct option are renamed to long_opts for consistency.

C89 positional initializers require values to be placed in the
correct order. This will cause errors if the fields of the struct
definition are reordered or fields are added or removed. C99 named
initializers avoid this problem, and also automatically clear any
values that are not explicitly set.

This patch updates lfs_changelog() to use the C99 syntax.

Test-Parameters: trivial
Signed-off-by: Steve Guminski <stephenx.guminski@intel.com>
Change-Id: I4f9d82974f68742d788f00d58c5e3d61449fc5bb
Reviewed-on: https://review.whamcloud.com/27522
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/utils/lfs.c

index 2d9eeeb..189c1dd 100644 (file)
@@ -4367,19 +4367,18 @@ static int lfs_ls(int argc, char **argv)
 
 static int lfs_changelog(int argc, char **argv)
 {
-        void *changelog_priv;
+       void *changelog_priv;
        struct changelog_rec *rec;
-        long long startrec = 0, endrec = 0;
-        char *mdd;
-        struct option long_opts[] = {
-                {"follow", no_argument, 0, 'f'},
-                {0, 0, 0, 0}
-        };
-        char short_opts[] = "f";
-        int rc, follow = 0;
-
-        while ((rc = getopt_long(argc, argv, short_opts,
-                                long_opts, NULL)) != -1) {
+       long long startrec = 0, endrec = 0;
+       char *mdd;
+       struct option long_opts[] = {
+               { .val = 'f', .name = "follow", .has_arg = no_argument },
+               { .name = NULL } };
+       char short_opts[] = "f";
+       int rc, follow = 0;
+
+       while ((rc = getopt_long(argc, argv, short_opts,
+               long_opts, NULL)) != -1) {
                 switch (rc) {
                 case 'f':
                         follow++;