summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2018-01-22 17:50:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-22 19:32:51 (GMT)
commitf919ffebed3c570bf3c2a5f36444527ea5df42de (patch)
tree3d89f307b743c893848413a72d32b36e9fd8ec17 /dir.c
parent8279ed033f703d4115bee620dccd32a9ec94d9aa (diff)
downloadgit-f919ffebed3c570bf3c2a5f36444527ea5df42de.zip
git-f919ffebed3c570bf3c2a5f36444527ea5df42de.tar.gz
git-f919ffebed3c570bf3c2a5f36444527ea5df42de.tar.bz2
Use MOVE_ARRAY
Use the helper macro MOVE_ARRAY to move arrays. This is shorter and safer, as it automatically infers the size of elements. Patch generated by Coccinelle and contrib/coccinelle/array.cocci in Travis CI's static analysis build job. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index 7c4b45e..ce6e50d 100644
--- a/dir.c
+++ b/dir.c
@@ -747,8 +747,8 @@ static struct untracked_cache_dir *lookup_untracked(struct untracked_cache *uc,
FLEX_ALLOC_MEM(d, name, name, len);
ALLOC_GROW(dir->dirs, dir->dirs_nr + 1, dir->dirs_alloc);
- memmove(dir->dirs + first + 1, dir->dirs + first,
- (dir->dirs_nr - first) * sizeof(*dir->dirs));
+ MOVE_ARRAY(dir->dirs + first + 1, dir->dirs + first,
+ dir->dirs_nr - first);
dir->dirs_nr++;
dir->dirs[first] = d;
return d;