Re: [PATCH v2 2/4] t-reftable-readwrite: use free_names() instead of a for loop
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 10, 2024, 06:10 UTC
- Message-ID
- <xmqqbk20aowc.fsf@gitster.g>
- In-Reply-To
- <CA+J6zkSHX892NoNOyTDc-38_giBR=Q-Hf7+7nymU9GnPu1V-5Q@mail.gmail.com>
Chandra Pratap <chandrapratap3519@gmail.com> writes:
Show 15 quoted lines
> On Sat, 10 Aug 2024 at 00:27, Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Chandra Pratap <chandrapratap3519@gmail.com> writes:
>>
>> > free_names() as defined by reftable/basics.{c,h} frees a NULL
>> > terminated array of malloced strings along with the array itself.
>> > Use this function instead of a for loop to free such an array.
>> ...
> This test is supposed to focus on reftable's read-write functionalities
> so it makes sense to explicitly #include only those headers that
> are directly responsible for those functionalities, namely 'reader.h',
> 'blocksource.h' and 'reftable-writer.h'. 'reftable-error.h' is thrown in
> there as well because some tests need to explicitly mention the
> various error codes and it doesn't make sense to rely on it being
> #included by others.I think we are on the same page. The code explicitly exercises free_names() after this step, and that is exactly why I found it odd to rely on basics.h happen to be included by some other header file(s) we explicitly include.
Thanks.