diff options
author | René Scharfe <l.s.r@web.de> | 2021-03-13 16:17:22 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-14 00:00:09 (GMT) |
commit | ca56dadb4b65ccaeab809d80db80a312dc00941a (patch) | |
tree | fa027eb80d076ebf7be7c3ea69a92cf47e594a1c /list-objects-filter.c | |
parent | f1121499e6460e814ec3cffa0b18942ac529f768 (diff) | |
download | git-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 'list-objects-filter.c')
-rw-r--r-- | list-objects-filter.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/list-objects-filter.c b/list-objects-filter.c index 4ec0041..39e2f15 100644 --- a/list-objects-filter.c +++ b/list-objects-filter.c @@ -186,7 +186,7 @@ static enum list_objects_filter_result filter_trees_depth( seen_info = oidmap_get( &filter_data->seen_at_depth, &obj->oid); if (!seen_info) { - seen_info = xcalloc(1, sizeof(*seen_info)); + CALLOC_ARRAY(seen_info, 1); oidcpy(&seen_info->base.oid, &obj->oid); seen_info->depth = filter_data->current_depth; oidmap_put(&filter_data->seen_at_depth, seen_info); @@ -626,7 +626,7 @@ static void filter_combine__init( size_t sub; d->nr = filter_options->sub_nr; - d->sub = xcalloc(d->nr, sizeof(*d->sub)); + CALLOC_ARRAY(d->sub, d->nr); for (sub = 0; sub < d->nr; sub++) d->sub[sub].filter = list_objects_filter__init( filter->omits ? &d->sub[sub].omits : NULL, @@ -674,7 +674,7 @@ struct filter *list_objects_filter__init( if (!init_fn) return NULL; - filter = xcalloc(1, sizeof(*filter)); + CALLOC_ARRAY(filter, 1); filter->omits = omitted; init_fn(filter_options, filter); return filter; |