]> git.ipfire.org Git - thirdparty/git.git/commit - xdiff/xprepare.c
xdiff: introduce XDL_ALLOC_ARRAY()
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Fri, 8 Jul 2022 16:25:16 +0000 (16:25 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Jul 2022 16:34:30 +0000 (09:34 -0700)
commitabf04bdaa845a6650d1f44b9f5914df442559d75
treec221dbd6f3fcac8d81ed84c96a3e6bc74ade434a
parente4a4b31577c7419497ac30cebe30d755b97752c5
xdiff: introduce XDL_ALLOC_ARRAY()

Add a helper to allocate an array that automatically calculates the
allocation size. This is analogous to ALLOC_ARRAY() in the rest of the
codebase but returns NULL if the allocation fails to accommodate other
users of libxdiff such as libgit2. The helper will also return NULL if
the multiplication in the allocation calculation overflows.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
xdiff/xdiffi.c
xdiff/xmacros.h
xdiff/xpatience.c
xdiff/xprepare.c