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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
60566cbb58
commit
45ccef87b3
@ -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)
|
||||
|
Reference in New Issue
Block a user