Re: [PATCH v4 00/25] reftable: handle allocation errors
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 1, 2024, 17:52 UTC
- Message-ID
- <xmqqzfnnyakq.fsf@gitster.g>
- In-Reply-To
- <cover.1727774935.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 15 quoted lines
> this is the fourth version of this patch series that converts the > reftable library to start handling allocation errors. This is done such > that the reftable library can truly behave like a library and let its > callers handle such conditions. > > Changes compared to v3: > > - Fix some additional sites where we use strdup(3P)/free(3P) by > accident. > > - Convert preexisting callsites of free(3P) to use reftable_free(). > > - Introduce a REFTABLE_FREE_AND_NULL() macro and use it. > > - Ban standard allocators in reftable code "banned.h"-style.
With this patch, there is only one hit from
$ git grep '[^_]free(' reftable/and no hits from
$ git grep '[^_]FREE_AND_NULL(' reftable/which is just as expected. Nicely done.
Shouldn't we add FREE_AND_NULL() to the banned list as well in the last step?
Thanks.