summaryrefslogtreecommitdiff
path: root/ref-filter.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-03-13 16:17:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-14 00:00:09 (GMT)
commitca56dadb4b65ccaeab809d80db80a312dc00941a (patch)
treefa027eb80d076ebf7be7c3ea69a92cf47e594a1c /ref-filter.c
parentf1121499e6460e814ec3cffa0b18942ac529f768 (diff)
downloadgit-ca56dadb4b65ccaeab809d80db80a312dc00941a.zip
git-ca56dadb4b65ccaeab809d80db80a312dc00941a.tar.gz
git-ca56dadb4b65ccaeab809d80db80a312dc00941a.tar.bz2
use CALLOC_ARRAY
Add and apply a semantic patch for converting code that open-codes CALLOC_ARRAY to use it instead. It shortens the code and infers the element size automatically. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ref-filter.c')
-rw-r--r--ref-filter.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ref-filter.c b/ref-filter.c
index e84efb5..643e69b 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1676,7 +1676,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
int i;
struct object_info empty = OBJECT_INFO_INIT;
- ref->value = xcalloc(used_atom_cnt, sizeof(struct atom_value));
+ CALLOC_ARRAY(ref->value, used_atom_cnt);
if (need_symref && (ref->flag & REF_ISSYMREF) && !ref->symref) {
ref->symref = resolve_refdup(ref->refname, RESOLVE_REF_READING,
@@ -2185,7 +2185,7 @@ static void reach_filter(struct ref_array *array,
if (!check_reachable)
return;
- to_clear = xcalloc(sizeof(struct commit *), array->nr);
+ CALLOC_ARRAY(to_clear, array->nr);
repo_init_revisions(the_repository, &revs, NULL);
@@ -2490,7 +2490,7 @@ void parse_ref_sorting(struct ref_sorting **sorting_tail, const char *arg)
{
struct ref_sorting *s;
- s = xcalloc(1, sizeof(*s));
+ CALLOC_ARRAY(s, 1);
s->next = *sorting_tail;
*sorting_tail = s;