]> git.ipfire.org Git - thirdparty/git.git/commitdiff
xcalloc: use CALLOC_ARRAY() when applicable
authorJunio C Hamano <gitster@pobox.com>
Mon, 15 Mar 2021 22:05:04 +0000 (15:05 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 Mar 2021 00:51:10 +0000 (17:51 -0700)
These are for codebase before Git 2.31

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c
t/helper/test-bloom.c

index ea3d0f01af3b7cfd90e1e235ee4e8694dabf8791..6a66687e28368497cb6764120d361cb4d9668546 100644 (file)
@@ -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;
index f0aa80b98eb3240c59db99e2b5fbc186fd87c717..eb7c011ca63b65fb93f97512e5216d18f863ad1e 100644 (file)
@@ -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);