Re: [PATCH 4/4] transport: drop "int cmp = cmp" hack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> I wonder, though, what made you look at this. It did not come up in my
> list of -Wuninitialized warnings. Did it get triggered by one of the
> other gcc versions?

No, but the function in question has that questionable construct
written by somebody who does not understand linked list, and it
dusgusted me enough to look at where that list came from, which
inevitably made me notice that "return dummy.next" that made me go
"wat?"

>
>> diff --git a/transport.c b/transport.c
>> index 87b8f14..e6f9346 100644
>> --- a/transport.c
>> +++ b/transport.c
>> @@ -106,7 +106,8 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
>>  		return;
>>  
>>  	for (;;) {
>> -		int cmp, len;
>> +		int cmp = 0; /* assigned before used */
>> +		int len;
>>  
>>  		if (!fgets(buffer, sizeof(buffer), f)) {
>>  			fclose(f);
>
> I think that's fine.
>
> -Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]