Skip to contentSkip to conversation

Sparse: fix a "symbol 'weak_match' shadows an earlier one" warning

RFC PATCH In review Ramsay Jones 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

RFC PATCH 10/10 Sparse: fix a "symbol 'weak_match' shadows an earlier one" warning

---
 connect.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
connect.c +0 -1
index da89c9c..d4051dd 100644
@@ -179,7 +179,6 @@ static int count_refspec_match(const char *pattern,
 	for (weak_match = match = 0; refs; refs = refs->next) {
 		char *name = refs->name;
 		int namelen = strlen(name);
-		int weak_match;
 
 		if (namelen < patlen ||
 		    memcmp(name + namelen - patlen, pattern, patlen))
Signature · 1 line
1.5.2
#1 lore raw
Quoted 10 lines · Ramsay Jones
---
 connect.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
connect.c +0 -0
index da89c9c..d4051dd 100644

connect.c static int count_refspec_match(const char *pattern, · line 184

Quoted 7 lines
connect.c +0 -1
@@ -179,7 +179,6 @@ static int count_refspec_match(const char *pattern,
 	for (weak_match = match = 0; refs; refs = refs->next) {
 		char *name = refs->name;
 		int namelen = strlen(name);
-		int weak_match;
 
 		if (namelen < patlen ||
 		    memcmp(name + namelen - patlen, pattern, patlen))

This one is an obvious bug. Essentially, it makes weak matches ignored. Unfortunately this has been hiding a larger bug in the caller of this function. I am refactoring the mess right now.

#2 lore raw
Quoted 17 lines · Junio C Hamano
Quoted 15 lines · Ramsay Jones
---
 connect.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
connect.c +0 -1
index da89c9c..d4051dd 100644
@@ -179,7 +179,6 @@ static int count_refspec_match(const char *pattern,
 	for (weak_match = match = 0; refs; refs = refs->next) {
 		char *name = refs->name;
 		int namelen = strlen(name);
-		int weak_match;
 
Quoted 4 lines

connect.c static int count_refspec_match(const char *pattern, · line 184

Quoted 2 lines
connect.c +0 -0
 		if (namelen < patlen ||
 		    memcmp(name + namelen - patlen, pattern, patlen))

This one is an obvious bug.

Indeed ;-)
Also, I'm guessing it does not bring your machine down like a house of cards.

... Essentially, it makes weak matches

Quoted 3 lines

ignored. Unfortunately this has been hiding a larger bug in the caller of this function. I am refactoring the mess right now.

Great. Hopefully it will also address the cygwin issue.

ATB

Ramsay Jones