summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-03-15 22:05:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-16 00:51:10 (GMT)
commit486f4bd183b2b9e3355c7d0d47462951c659613d (patch)
treeb01187eb87030752ca53a36c869bd2197524b7d4
parent6ff7f460394745395f3eec1e414ad2300c6a402f (diff)
downloadgit-486f4bd183b2b9e3355c7d0d47462951c659613d.zip
git-486f4bd183b2b9e3355c7d0d47462951c659613d.tar.gz
git-486f4bd183b2b9e3355c7d0d47462951c659613d.tar.bz2
xcalloc: use CALLOC_ARRAY() when applicable
These are for codebase before Git 2.31 Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/receive-pack.c8
-rw-r--r--t/helper/test-bloom.c2
2 files changed, 4 insertions, 6 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index ea3d0f0..6a66687 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1837,11 +1837,9 @@ static void prepare_shallow_update(struct shallow_info *si)
ALLOC_ARRAY(si->used_shallow, si->shallow->nr);
assign_shallow_commits_to_refs(si, si->used_shallow, NULL);
- si->need_reachability_test =
- xcalloc(si->shallow->nr, sizeof(*si->need_reachability_test));
- si->reachable =
- xcalloc(si->shallow->nr, sizeof(*si->reachable));
- si->shallow_ref = xcalloc(si->ref->nr, sizeof(*si->shallow_ref));
+ CALLOC_ARRAY(si->need_reachability_test, si->shallow->nr);
+ CALLOC_ARRAY(si->reachable, si->shallow->nr);
+ CALLOC_ARRAY(si->shallow_ref, si->ref->nr);
for (i = 0; i < si->nr_ours; i++)
si->need_reachability_test[si->ours[i]] = 1;
diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c
index f0aa80b..eb7c011 100644
--- a/t/helper/test-bloom.c
+++ b/t/helper/test-bloom.c
@@ -65,7 +65,7 @@ int cmd__bloom(int argc, const char **argv)
struct bloom_filter filter;
int i = 2;
filter.len = (settings.bits_per_entry + BITS_PER_WORD - 1) / BITS_PER_WORD;
- filter.data = xcalloc(filter.len, sizeof(unsigned char));
+ CALLOC_ARRAY(filter.data, filter.len);
if (argc - 1 < i)
usage(bloom_usage);