summaryrefslogtreecommitdiff
path: root/builtin/mv.c
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2016-09-25 09:24:03 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-09-25 16:44:13 -0700
commit45ccef87b3cc0ab09ec5fd1186aa0b33298ee8d4 (patch)
tree83dffbe2e99b0fd98a286208a655012a86fb292b /builtin/mv.c
parentadd COPY_ARRAY (diff)
downloadtgif-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 'builtin/mv.c')
-rw-r--r--builtin/mv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/mv.c b/builtin/mv.c
index a2014266b6..c13e49bf47 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -26,7 +26,7 @@ static const char **internal_copy_pathspec(const char *prefix,
int i;
const char **result;
ALLOC_ARRAY(result, count + 1);
- memcpy(result, pathspec, count * sizeof(const char *));
+ COPY_ARRAY(result, pathspec, count);
result[count] = NULL;
for (i = 0; i < count; i++) {
int length = strlen(result[i]);