Skip to content

Commit eabacfd

Browse files
committed
Merge branch 'jc/calloc-fix'
Code clean-up. * jc/calloc-fix: xcalloc: use CALLOC_ARRAY() when applicable
2 parents a5828ae + 486f4bd commit eabacfd

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
@@ -2313,11 +2313,9 @@ static void prepare_shallow_update(struct shallow_info *si)
23132313
ALLOC_ARRAY(si->used_shallow, si->shallow->nr);
23142314
assign_shallow_commits_to_refs(si, si->used_shallow, NULL);
23152315

2316-
si->need_reachability_test =
2317-
xcalloc(si->shallow->nr, sizeof(*si->need_reachability_test));
2318-
si->reachable =
2319-
xcalloc(si->shallow->nr, sizeof(*si->reachable));
2320-
si->shallow_ref = xcalloc(si->ref->nr, sizeof(*si->shallow_ref));
2316+
CALLOC_ARRAY(si->need_reachability_test, si->shallow->nr);
2317+
CALLOC_ARRAY(si->reachable, si->shallow->nr);
2318+
CALLOC_ARRAY(si->shallow_ref, si->ref->nr);
23212319

23222320
for (i = 0; i < si->nr_ours; i++)
23232321
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
@@ -69,7 +69,7 @@ int cmd__bloom(int argc, const char **argv)
6969
struct bloom_filter filter;
7070
int i = 2;
7171
filter.len = (settings.bits_per_entry + BITS_PER_WORD - 1) / BITS_PER_WORD;
72-
filter.data = xcalloc(filter.len, sizeof(unsigned char));
72+
CALLOC_ARRAY(filter.data, filter.len);
7373

7474
if (argc - 1 < i)
7575
usage(bloom_usage);

0 commit comments

Comments
 (0)