summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2022-09-20 03:55:50 +0200
committerJunio C Hamano <gitster@pobox.com>2022-09-21 19:21:46 +0200
commitcb6c48cbbc7e196739b42c16c84fa320cc82b5c4 (patch)
tree1ad65c9e7389ce3e6901e937b60506f2bcceb92d
parentmidx.c: avoid cruft packs with `repack --batch-size=0` (diff)
downloadgit-cb6c48cbbc7e196739b42c16c84fa320cc82b5c4.tar.xz
git-cb6c48cbbc7e196739b42c16c84fa320cc82b5c4.zip
midx.c: replace `xcalloc()` with `CALLOC_ARRAY()`
Replace a direct invocation of Git's `xcalloc()` wrapper with the `CALLOC_ARRAY()` macro instead. The latter is preferred since it is more conventional in Git's codebase, but also because it automatically picks the correct value for the record size. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--midx.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/midx.c b/midx.c
index 05bcfc6f02..d703fc5a16 100644
--- a/midx.c
+++ b/midx.c
@@ -1912,9 +1912,11 @@ static int fill_included_packs_batch(struct repository *r,
{
uint32_t i, packs_to_repack;
size_t total_size;
- struct repack_info *pack_info = xcalloc(m->num_packs, sizeof(struct repack_info));
+ struct repack_info *pack_info;
int pack_kept_objects = 0;
+ CALLOC_ARRAY(pack_info, m->num_packs);
+
repo_config_get_bool(r, "repack.packkeptobjects", &pack_kept_objects);
for (i = 0; i < m->num_packs; i++) {