threads / rfc / 8522

RFC patch, 10 partsSparse: fix a "symbol 'weak_match' shadows an earlier one" warning

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

## tl;dr

3 messages between Jun 8, 2007 and Jun 12, 2007. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Ramsay Jones· Jun 8, 2007, 22:27 UTC · lore
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 connect.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
Show changes to connect.c +0 −1
diff --git a/connect.c b/connect.c
index da89c9c..d4051dd 100644
--- a/connect.c
+++ b/connect.c
@@ -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))
-- 
1.5.2
Junio C Hamano· Jun 9, 2007, 08:07 UTC · re: Ramsay Jones · lore

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

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
Show 17 quoted lines
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>  connect.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/connect.c b/connect.c
> index da89c9c..d4051dd 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -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.

Ramsay Jones· Jun 12, 2007, 17:43 UTC · re: Junio C Hamano · lore

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

Junio C Hamano wrote:
Show 21 quoted lines
> Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
> 
>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
>> ---
>>  connect.c |    1 -
>>  1 files changed, 0 insertions(+), 1 deletions(-)
>>
>> diff --git a/connect.c b/connect.c
>> index da89c9c..d4051dd 100644
>> --- a/connect.c
>> +++ b/connect.c
>> @@ -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.  

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

... 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.
> 
Great. Hopefully it will also address the cygwin issue.
ATB
Ramsay Jones

← back to recent threads