aboutsummaryrefslogtreecommitdiffstats
path: root/commit-reach.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-03-19 15:25:38 -0700
committerJunio C Hamano <gitster@pobox.com>2021-03-19 15:25:38 -0700
commit92ccd7b7529a852583c5033ba28b4414cd2f7654 (patch)
treebce1548bcd2cd806a4524b812fb56f19b397b7d2 /commit-reach.c
parentMerge branch 'rs/avoid-null-statement-after-macro-call' (diff)
parentcocci: allow xcalloc(1, size) (diff)
downloadgit-92ccd7b7529a852583c5033ba28b4414cd2f7654.tar.gz
git-92ccd7b7529a852583c5033ba28b4414cd2f7654.zip
Merge branch 'rs/calloc-array'
CALLOC_ARRAY() macro replaces many uses of xcalloc(). * rs/calloc-array: cocci: allow xcalloc(1, size) use CALLOC_ARRAY git-compat-util.h: drop trailing semicolon from macro definition
Diffstat (limited to 'commit-reach.c')
-rw-r--r--commit-reach.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/commit-reach.c b/commit-reach.c
index 2ea84d3dc0..c226ee3da4 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -183,7 +183,7 @@ static int remove_redundant_no_gen(struct repository *r,
int *filled_index;
int i, j, filled;
- work = xcalloc(cnt, sizeof(*work));
+ CALLOC_ARRAY(work, cnt);
redundant = xcalloc(cnt, 1);
ALLOC_ARRAY(filled_index, cnt - 1);
@@ -399,7 +399,7 @@ static struct commit_list *get_merge_bases_many_0(struct repository *r,
/* There are more than one */
cnt = commit_list_count(result);
- rslt = xcalloc(cnt, sizeof(*rslt));
+ CALLOC_ARRAY(rslt, cnt);
for (list = result, i = 0; list; list = list->next)
rslt[i++] = list->item;
free_commit_list(result);
@@ -541,7 +541,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)
p->item->object.flags |= STALE;
num_head++;
}
- array = xcalloc(num_head, sizeof(*array));
+ CALLOC_ARRAY(array, num_head);
for (p = heads, i = 0; p; p = p->next) {
if (p->item->object.flags & STALE) {
array[i++] = p->item;