Skip to content

Commit 486f4bd

Browse files
committed
xcalloc: use CALLOC_ARRAY() when applicable
These are for codebase before Git 2.31 Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6ff7f46 commit 486f4bd

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

builtin/receive-pack.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,11 +1837,9 @@ static void prepare_shallow_update(struct shallow_info *si)
18371837
ALLOC_ARRAY(si->used_shallow, si->shallow->nr);
18381838
assign_shallow_commits_to_refs(si, si->used_shallow, NULL);
18391839

1840-
si->need_reachability_test =
1841-
xcalloc(si->shallow->nr, sizeof(*si->need_reachability_test));
1842-
si->reachable =
1843-
xcalloc(si->shallow->nr, sizeof(*si->reachable));
1844-
si->shallow_ref = xcalloc(si->ref->nr, sizeof(*si->shallow_ref));
1840+
CALLOC_ARRAY(si->need_reachability_test, si->shallow->nr);
1841+
CALLOC_ARRAY(si->reachable, si->shallow->nr);
1842+
CALLOC_ARRAY(si->shallow_ref, si->ref->nr);
18451843

18461844
for (i = 0; i < si->nr_ours; i++)
18471845
si->need_reachability_test[si->ours[i]] = 1;

t/helper/test-bloom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int cmd__bloom(int argc, const char **argv)
6565
struct bloom_filter filter;
6666
int i = 2;
6767
filter.len = (settings.bits_per_entry + BITS_PER_WORD - 1) / BITS_PER_WORD;
68-
filter.data = xcalloc(filter.len, sizeof(unsigned char));
68+
CALLOC_ARRAY(filter.data, filter.len);
6969

7070
if (argc - 1 < i)
7171
usage(bloom_usage);

0 commit comments

Comments
 (0)