Re: [PATCH v4 25/25] reftable/basics: ban standard allocator functions
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 1, 2024, 22:50 UTC
- Message-ID
- <xmqqh69vsail.fsf@gitster.g>
- In-Reply-To
- <764961e6f02b8e5788bce75830559b70c2e6f231.1727774935.git.ps@pks.im>
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.
Show 6 quoted lines
> +# 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