Subject: Re: [PATCH v3 10/12] config.c: remove config_reader from configsets

From: Junio C Hamano <[email-masked]>
Date: Fri, 23 Jun 2023 14:33:01 -0700

Jonathan Tan <[email-masked]> writes:

> "Glen Choo via GitGitGadget" <[email-masked]> writes:
>> @@ -2429,11 +2427,7 @@ static int configset_add_value(const struct key_value_info *kvi_p,
>>  	l_item->e = e;
>>  	l_item->value_index = e->value_list.nr - 1;
>>  
>> -	if (reader->source->name) {
>> -		kvi_from_source(reader->source, kvi_p->scope, kv_info);
>> -	} else {
>> -		kvi_from_param(kv_info);
>> -	}
>> +	memcpy(kv_info, kvi_p, sizeof(struct key_value_info));
>>  	si->util = kv_info;
>>  
>>  	return 0;
>
> Ah, I remember seeing this memcpy from the previous round, but forgot to
> comment on it (I only commented on another instance, [1]).

Yeah, I noticed this and recalled seeing a comment on structure
assignment.  As both are pointers,

    *kv_info = *kvi_p;

would sufficiently stand out to notify us that we are doing a
not-trivial assignment here, and would avoid (slight) risks of typos
by type checking.

> Other than that, up to here looks good.
>
> [1] https://lore.kernel.org/git/[email-masked]/
>