summaryrefslogtreecommitdiff
path: root/xdiff/xpatience.c
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2022-07-08 16:25:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-08 16:34:30 (GMT)
commit18aae7e21e1a88c75adb38aa2555e0b1928b137d (patch)
tree1f48acc01e9e7b01cf8380dad5a9f4277db437b5 /xdiff/xpatience.c
parentabf04bdaa845a6650d1f44b9f5914df442559d75 (diff)
downloadgit-18aae7e21e1a88c75adb38aa2555e0b1928b137d.zip
git-18aae7e21e1a88c75adb38aa2555e0b1928b137d.tar.gz
git-18aae7e21e1a88c75adb38aa2555e0b1928b137d.tar.bz2
xdiff: introduce xdl_calloc
In preparation for introducing XDL_CALLOC_ARRAY() use calloc() to obtain zeroed out memory rather than malloc() followed by memset(). To try and keep the lines a reasonable length this commit also stops casting the pointer returned by calloc() as this is unnecessary. 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.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/xdiff/xpatience.c b/xdiff/xpatience.c
index ce87b90..94f8886 100644
--- a/xdiff/xpatience.c
+++ b/xdiff/xpatience.c
@@ -151,11 +151,9 @@ 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 = (struct entry *)
- xdl_malloc(result->alloc * sizeof(struct entry));
+ result->entries = xdl_calloc(result->alloc, sizeof(*result->entries));
if (!result->entries)
return -1;
- memset(result->entries, 0, result->alloc * sizeof(struct entry));
/* First, fill with entries from the first file */
while (count1--)