From: Sami Kerola Date: Sat, 29 Dec 2012 16:51:03 +0000 (+0000) Subject: anacron: fix shadow declarations X-Git-Tag: cronie1.4.11~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8958381e38fad2f8d0e775c851dad40e8de7146;p=cronie anacron: fix shadow declarations 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 --- diff --git a/anacron/global.h b/anacron/global.h index 2298f3c..9d5ef76 100644 --- a/anacron/global.h +++ b/anacron/global.h @@ -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; diff --git a/anacron/main.c b/anacron/main.c index be0585f..7889983 100644 --- a/anacron/main.c +++ b/anacron/main.c @@ -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; } } diff --git a/anacron/readtab.c b/anacron/readtab.c index 48fd98b..e378faf 100644 --- a/anacron/readtab.c +++ b/anacron/readtab.c @@ -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"); }