* [PATCH] Fix two shadow compiler warnings
@ 2014-08-15 21:02 Brian Haley
2014-08-15 21:18 ` Dave Jones
0 siblings, 1 reply; 3+ messages in thread
From: Brian Haley @ 2014-08-15 21:02 UTC (permalink / raw)
To: trinity
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix two shadow compiler warnings
2014-08-15 21:02 [PATCH] Fix two shadow compiler warnings Brian Haley
@ 2014-08-15 21:18 ` Dave Jones
2014-08-15 21:41 ` Brian Haley
0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2014-08-15 21:18 UTC (permalink / raw)
To: Brian Haley; +Cc: trinity
On Fri, Aug 15, 2014 at 05:02:39PM -0400, Brian Haley wrote:
> 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]
ugh, what gcc is that with ?
It seems 4.9.1 is smart enough to figure out that isn't a problem.
I'll apply the patch though.
Dave
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix two shadow compiler warnings
2014-08-15 21:18 ` Dave Jones
@ 2014-08-15 21:41 ` Brian Haley
0 siblings, 0 replies; 3+ messages in thread
From: Brian Haley @ 2014-08-15 21:41 UTC (permalink / raw)
To: Dave Jones; +Cc: trinity
On 08/15/2014 05:18 PM, Dave Jones wrote:
> On Fri, Aug 15, 2014 at 05:02:39PM -0400, Brian Haley wrote:
> > 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]
>
> ugh, what gcc is that with ?
> It seems 4.9.1 is smart enough to figure out that isn't a problem.
My old 12.04.5 LTS system:
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
-Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-15 21:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-15 21:02 [PATCH] Fix two shadow compiler warnings Brian Haley
2014-08-15 21:18 ` Dave Jones
2014-08-15 21:41 ` Brian Haley
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 NNTP newsgroup(s).