comerr: avoid comma operator
authorMichael Meffie <mmeffie@sinenomine.net>
Fri, 22 Nov 2013 20:26:34 +0000 (15:26 -0500)
committerDerrick Brashear <shadow@your-file-system.com>
Tue, 28 Jan 2014 01:58:04 +0000 (17:58 -0800)
Avoid unnecessary use of the comma operator in compile_et's
command-line argument processing.

Change-Id: If9308d211676be471f3534e144c7d90214994699
Reviewed-on: http://gerrit.openafs.org/10491
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/comerr/compile_et.c

index c73433f..982cabb 100644 (file)
@@ -162,8 +162,8 @@ main(int argc, char **argv)
     p = strrchr(whoami, '/');
     if (p)
        whoami = p + 1;
-    while (argv++, --argc) {
-       char *arg = *argv;
+    while (--argc) {
+       char *arg = *++argv;
        if (arg[0] != '-') {
            if (filename)
                dup_err("filenames", filename, arg);
@@ -174,7 +174,8 @@ main(int argc, char **argv)
                debug++;
            else if (check_arg(lang_args, arg)) {
                got_language++;
-               arg = *++argv, argc--;
+               arg = *++argv;
+               argc--;
                if (!arg)
                    usage();
                if (language)
@@ -201,17 +202,20 @@ main(int argc, char **argv)
                    exit(1);
                }
            } else if (strcmp(arg, "h") == 0) {
-               arg = *++argv, argc--;
+               arg = *++argv;
+               argc--;
                if (!arg)
                    usage();
                got_include = arg;
            } else if (strcmp(arg, "p") == 0) {
-               arg = *++argv, argc--;
+               arg = *++argv;
+               argc--;
                if (!arg)
                    usage();
                got_prefix = arg;
            } else if (strcmp(arg, "v") == 0) {
-               arg = *++argv, argc--;
+               arg = *++argv;
+               argc--;
                if (arg == NULL) {
                    fprintf(stderr, "%s: -v option requires an argument\n",
                            whoami);