use DUP_ARRAY

Add a semantic patch for replace ALLOC_ARRAY+COPY_ARRAY with DUP_ARRAY
to reduce code duplication and apply its results.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2023-01-01 22:16:48 +01:00
committed by Junio C Hamano
parent d2ec87a684
commit 6e57841096
8 changed files with 15 additions and 16 deletions

3
attr.c
View File

@ -599,8 +599,7 @@ struct attr_check *attr_check_dup(const struct attr_check *check)
ret->nr = check->nr;
ret->alloc = check->alloc;
ALLOC_ARRAY(ret->items, ret->nr);
COPY_ARRAY(ret->items, check->items, ret->nr);
DUP_ARRAY(ret->items, check->items, ret->nr);
return ret;
}