From 45ccef87b3cc0ab09ec5fd1186aa0b33298ee8d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sun, 25 Sep 2016 09:24:03 +0200 Subject: use COPY_ARRAY Add a semantic patch for converting certain calls of memcpy(3) to COPY_ARRAY() and apply that transformation to the code base. The result is shorter and safer code. For now only consider calls where source and destination have the same type, or in other words: easy cases. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- pathspec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'pathspec.c') diff --git a/pathspec.c b/pathspec.c index 24e0dd523..49a53607b 100644 --- a/pathspec.c +++ b/pathspec.c @@ -485,8 +485,7 @@ void copy_pathspec(struct pathspec *dst, const struct pathspec *src) { *dst = *src; ALLOC_ARRAY(dst->items, dst->nr); - memcpy(dst->items, src->items, - sizeof(struct pathspec_item) * dst->nr); + COPY_ARRAY(dst->items, src->items, dst->nr); } void clear_pathspec(struct pathspec *pathspec) -- cgit v1.2.1