]> granicus.if.org Git - cronie/commitdiff
anacron: fix shadow declarations
authorSami Kerola <kerolasa@iki.fi>
Sat, 29 Dec 2012 16:51:03 +0000 (16:51 +0000)
committerTomas Mraz <tmraz@fedoraproject.org>
Thu, 17 Jan 2013 13:07:40 +0000 (14:07 +0100)
Change global variables to have more specific name.  This will make
warnings about shadowing to go away, and may result to a little more
readable code.

log.c:74:35: warning: declaration of 'args' shadows a global declaration [-Wshadow]
global.h:97:15: warning: shadowed declaration is here [-Wshadow]

Reference: http://web.archiveorange.com/archive/v/N6p0RpcfZsIBsaU8B2sE#72jDywyk8NZ3i9g
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
anacron/global.h
anacron/main.c
anacron/readtab.c

index 2298f3c887d2dab9040e9166dc1aca5a998db90f..9d5ef76c1e09329e28d3261fd21c75097295a133 100644 (file)
@@ -94,8 +94,8 @@ extern int in_background;
 extern job_rec *first_job_rec;
 extern env_rec *first_env_rec;
 
-extern char **args;
-extern int nargs;
+extern char **job_args;
+extern int job_nargs;
 
 extern int njobs;
 extern job_rec **job_array;
index be0585fc2d9af155318841dde897d59cb073d055..7889983294e22a7cf8c7adac6a974139d226c17b 100644 (file)
@@ -47,8 +47,8 @@ char *anacrontab;
 char *spooldir;
 int serialize, force, update_only, now,
     no_daemon, quiet, testing_only;            /* command-line options */
-char **args;                       /* vector of "job" command-line arguments */
-int nargs;                                     /* number of these */
+char **job_args;                                      /* vector of "job" command-line arguments */
+int job_nargs;                                 /* number of these */
 char *defarg = "*";
 int in_background;                             /* are we in the background? */
 int old_umask;                                 /* umask when started */
@@ -153,13 +153,13 @@ parse_opts(int argc, char *argv[])
     if (optind == argc)
     {
        /* no arguments. Equivalent to: `*' */
-       nargs = 1;
-       args = &defarg;
+       job_nargs = 1;
+       job_args = &defarg;
     }
     else
     {
-       nargs = argc - optind;
-       args = argv + optind;
+       job_nargs = argc - optind;
+       job_args = argv + optind;
     }
 }
 
index 48fd98b43209bc9b1518507def1f36320b27f0b2..e378faf26cf86cad30ffb6025dce8d38fa247580 100644 (file)
@@ -116,9 +116,9 @@ job_arg_num(const char *ident)
 {
     int i, r;
 
-    for (i = 0; i < nargs; i++)
+    for (i = 0; i < job_nargs; i++)
     {
-       r = fnmatch(args[i], ident, 0);
+       r = fnmatch(job_args[i], ident, 0);
        if (r == 0) return i;
        if (r != FNM_NOMATCH) die("fnmatch() error");
     }