Re: [PATCH v4 25/25] reftable/basics: ban standard allocator functions
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 2, 2024, 04:30 UTC
- Message-ID
- <ZvzMbxdfRZU9pQ76@pks.im>
- In-Reply-To
- <xmqqh69vsail.fsf@gitster.g>
On Tue, Oct 01, 2024 at 03:50:42PM -0700, Junio C Hamano wrote:
Show 21 quoted lines
> Patrick Steinhardt <ps@pks.im> writes: > > > +#ifndef REFTABLE_ALLOW_BANNED_ALLOCATORS > > +# define REFTABLE_BANNED(func) use_reftable_##func##_instead > > We'd need to mimic banned.h a bit better, by adding > > #undef malloc > #undef realloc > #undef free > #undef calloc > #undef strdup > > before (potentially re-)defining them. > > > +# define malloc(sz) REFTABLE_BANNED(malloc) > > +# define realloc(ptr, sz) REFTABLE_BANNED(realloc) > > +# define free(ptr) REFTABLE_BANNED(free) > > +# define calloc(nelem, elsize) REFTABLE_BANNED(calloc) > > +# define strdup(str) REFTABLE_BANNED(strdup) > > +#endif
Oh, indeed, that's something I missed. Will do for a hopefully last reroll.
Patrick