Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-09-25 10:24:03 +0300
committerJunio C Hamano <gitster@pobox.com>2016-09-26 02:44:13 +0300
commit45ccef87b3cc0ab09ec5fd1186aa0b33298ee8d4 (patch)
tree83dffbe2e99b0fd98a286208a655012a86fb292b /pack-revindex.c
parent60566cbb5890abc84fa18c56da70e35ace0b23bf (diff)
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 'pack-revindex.c')
-rw-r--r--pack-revindex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pack-revindex.c b/pack-revindex.c
index 96d51c3467..6bc7c94033 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);