From: Brian Haley <brian.haley@hp.com>
To: trinity@vger.kernel.org
Subject: [PATCH] Fix two shadow compiler warnings
Date: Fri, 15 Aug 2014 17:02:39 -0400 [thread overview]
Message-ID: <1408136559-13716-1-git-send-email-brian.haley@hp.com> (raw)
CC fd-files.o
fd-files.c: In function ‘list_to_index’:
fd-files.c:216:15: warning: declaration of ‘index’ shadows a global declaration [-Wshadow]
CC fds.o
fds.c: In function ‘process_disable_fds_param’:
fds.c:164:38: warning: declaration of ‘optarg’ shadows a global declaration [-Wshadow]
Signed-off-by: Brian Haley <brian.haley@hp.com>
---
fd-files.c | 8 ++++----
fds.c | 14 +++++++-------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/fd-files.c b/fd-files.c
index 6e0e37d..59dce01 100644
--- a/fd-files.c
+++ b/fd-files.c
@@ -213,14 +213,14 @@ static const char ** list_to_index(struct namelist *namelist)
{
struct list_head *node, *tmp;
struct namelist *nl;
- const char **index;
+ const char **findex;
unsigned int i = 0;
- index = zmalloc(sizeof(char *) * files_in_index);
+ findex = zmalloc(sizeof(char *) * files_in_index);
list_for_each_safe(node, tmp, &namelist->list) {
nl = (struct namelist *) node;
- index[i++] = nl->name;
+ findex[i++] = nl->name;
/* Destroy the list head, but keep the ->name alloc because
* now the index points to it.
@@ -232,7 +232,7 @@ static const char ** list_to_index(struct namelist *namelist)
free(names);
names = NULL;
- return index;
+ return findex;
}
static void generate_filelist(void)
diff --git a/fds.c b/fds.c
index ad963f9..79febcd 100644
--- a/fds.c
+++ b/fds.c
@@ -161,23 +161,23 @@ static void disable_fds_param(char *str)
exit(EXIT_FAILURE);
}
-void process_disable_fds_param(char *optarg)
+void process_disable_fds_param(char *param)
{
unsigned int len, i;
- char *str = optarg;
+ char *str = param;
- len = strlen(optarg);
+ len = strlen(param);
/* Check if there are any commas. If so, split them into multiple params,
* validating them as we go.
*/
for (i = 0; i < len; i++) {
- if (optarg[i] == ',') {
- optarg[i] = 0;
+ if (param[i] == ',') {
+ param[i] = 0;
disable_fds_param(str);
- str = optarg + i + 1;
+ str = param + i + 1;
}
}
- if (str < optarg + len)
+ if (str < param + len)
disable_fds_param(str);
}
--
1.7.9.5
next reply other threads:[~2014-08-15 21:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-15 21:02 Brian Haley [this message]
2014-08-15 21:18 ` [PATCH] Fix two shadow compiler warnings Dave Jones
2014-08-15 21:41 ` Brian Haley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408136559-13716-1-git-send-email-brian.haley@hp.com \
--to=brian.haley@hp.com \
--cc=trinity@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).