Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2022-07-08 19:25:18 +0300
committerJunio C Hamano <gitster@pobox.com>2022-07-08 19:34:30 +0300
commit848fd5ae5b6506df50ae872302d94b794dc57d51 (patch)
treee826df62795df5dd9b55b1f4aa0c38005e7a2294 /xdiff/xpatience.c
parent18aae7e21e1a88c75adb38aa2555e0b1928b137d (diff)
xdiff: introduce XDL_CALLOC_ARRAY()
Add a helper for allocating an array and initialize the elements to zero. This is analogous to CALLOC_ARRAY() in the rest of the codebase but it returns NULL on allocation failures rather than dying to accommodate other users of libxdiff such as libgit2. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff/xpatience.c')
-rw-r--r--xdiff/xpatience.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/xdiff/xpatience.c b/xdiff/xpatience.c
index 94f8886dd1..fe39c2978c 100644
--- a/xdiff/xpatience.c
+++ b/xdiff/xpatience.c
@@ -151,8 +151,7 @@ static int fill_hashmap(mmfile_t *file1, mmfile_t *file2,
/* We know exactly how large we want the hash map */
result->alloc = count1 * 2;
- result->entries = xdl_calloc(result->alloc, sizeof(*result->entries));
- if (!result->entries)
+ if (!XDL_CALLOC_ARRAY(result->entries, result->alloc))
return -1;
/* First, fill with entries from the first file */