Re: [PATCH 3/5] commit-graph: validate layers for generation data

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

 



On 2/1/2021 12:39 PM, Taylor Blau wrote:
> On Mon, Feb 01, 2021 at 05:15:05PM +0000, Derrick Stolee via GitGitGadget wrote:
>> +	struct commit_graph *p = g;
>>
>> -	if (!g)
>> -		return;
>> -
>> -	read_generation_data = !!g->chunk_generation_data;
>> +	while (read_generation_data && p) {
>> +		read_generation_data = p->read_generation_data;
>> +		p = p->base_graph;
>> +	}
> 
> This could probably be guarded with an 'if !read_generation_data', since
> if the previous while loop always read '1' from
> 'p->read_generation_data', then nothing needs updating, no?
> 
> (If you do make this change, please don't add '!read_generation_data' to
> the while expression, since it isn't a property of the loop.)

True, we could do that. It's enough to add

	if (read_generation_data)
		return 1;

>>  	while (g) {
>>  		g->read_generation_data = read_generation_data;
>>  		g = g->base_graph;
>>  	}
>> +
>> +	return read_generation_data;

then this becomes

	return 0;

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