Re: [PATCH v4 05/10] unpack-trees: fix nested sparse-dir search

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

 



On 8/24/2021 6:21 PM, René Scharfe wrote:
> Am 24.08.21 um 23:51 schrieb Derrick Stolee via GitGitGadget:
>> -	struct cache_entry *ce;
>> +	const char *path;
>> +	struct cache_entry *ce = NULL;
>                               ^^^^^^^
> This added initialization doesn't seem to be needed...
> 
>>  	int pos = find_cache_pos(info, p->path, p->pathlen);
>>  	struct unpack_trees_options *o = info->data;
>>
>> @@ -1283,7 +1284,9 @@ static struct cache_entry *find_cache_entry(struct traverse_info *info,
>>  	while (pos >= 0) {
>>  		ce = o->src_index->cache[pos];
> 
> ... because ce is set here before it's used.

Better yet, 'ce' is only used within the while loop, so its
declaration can be moved to this line instead.

Thanks,
-Stolee



[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]

  Powered by Linux