aboutsummaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-09-25 09:24:03 +0200
committerJunio C Hamano <gitster@pobox.com>2016-09-25 16:44:13 -0700
commit45ccef87b3cc0ab09ec5fd1186aa0b33298ee8d4 (patch)
tree83dffbe2e99b0fd98a286208a655012a86fb292b /commit.c
parent60566cbb5890abc84fa18c56da70e35ace0b23bf (diff)
downloadgit-45ccef87b3cc0ab09ec5fd1186aa0b33298ee8d4.tar.gz
git-45ccef87b3cc0ab09ec5fd1186aa0b33298ee8d4.tar.xz
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>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index 2a90e3751..9d3d7119e 100644
--- a/commit.c
+++ b/commit.c
@@ -931,7 +931,7 @@ static int remove_redundant(struct commit **array, int cnt)
}
/* Now collect the result */
- memcpy(work, array, sizeof(*array) * cnt);
+ COPY_ARRAY(work, array, cnt);
for (i = filled = 0; i < cnt; i++)
if (!redundant[i])
array[filled++] = work[i];