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 --- pack-revindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pack-revindex.c') diff --git a/pack-revindex.c b/pack-revindex.c index 96d51c346..6bc7c9403 100644 --- a/pack-revindex.c +++ b/pack-revindex.c @@ -107,7 +107,7 @@ static void sort_revindex(struct revindex_entry *entries, unsigned n, off_t max) * we have to move it back from the temporary storage. */ if (from != entries) - memcpy(entries, tmp, n * sizeof(*entries)); + COPY_ARRAY(entries, tmp, n); free(tmp); free(pos); -- cgit v1.2.1