diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-10-02 12:56:39 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-10-02 07:53:56 -0700 |
commit | 35730302e995337766805299fa1128c1b9d8988c (patch) | |
tree | cc32582d5cbb63da215213b56980d03dc1c7c3c8 /diffcore-rotate.c | |
parent | 24e0ade65baabccc3d6fcbde2f9c6eca0a0b7321 (diff) |
reftable/basics: ban standard allocator functions
The reftable library uses pluggable allocators, which means that we
shouldn't ever use the standard allocator functions. But it is an easy
mistake to make to accidentally use e.g. free(3P) instead of the
reftable-specific `reftable_free()` function, and we do not have any
mechanism to detect this misuse right now.
Introduce a couple of macros that ban the standard allocators, similar
to how we do it in "banned.h".
Note that we do not ban the following two classes of functions:
- Macros like `FREE_AND_NULL()` or `REALLOC_ARRAY()`. As those expand
to code that contains already-banned functions we'd get a compiler
error even without banning those macros explicitly.
- Git-specific allocators like `xmalloc()` and friends. The primary
reason is that there are simply too many of them, so we're rather
aiming for best effort here. Furthermore, the eventual goal is to
make them unavailable in the reftable library place by not pulling
them in via "git-compat-utils.h" anymore.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-rotate.c')
0 files changed, 0 insertions, 0 deletions