diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2018-01-22 18:50:09 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-01-22 20:32:51 +0100 |
commit | f919ffebed3c570bf3c2a5f36444527ea5df42de (patch) | |
tree | 3d89f307b743c893848413a72d32b36e9fd8ec17 /refs/ref-cache.c | |
parent | Git 2.16.1 (diff) | |
download | git-f919ffebed3c570bf3c2a5f36444527ea5df42de.tar.xz git-f919ffebed3c570bf3c2a5f36444527ea5df42de.zip |
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 'refs/ref-cache.c')
-rw-r--r-- | refs/ref-cache.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/refs/ref-cache.c b/refs/ref-cache.c index 82c1cf90a7..e90bd3e727 100644 --- a/refs/ref-cache.c +++ b/refs/ref-cache.c @@ -238,10 +238,8 @@ int remove_entry_from_dir(struct ref_dir *dir, const char *refname) return -1; entry = dir->entries[entry_index]; - memmove(&dir->entries[entry_index], - &dir->entries[entry_index + 1], - (dir->nr - entry_index - 1) * sizeof(*dir->entries) - ); + MOVE_ARRAY(&dir->entries[entry_index], + &dir->entries[entry_index + 1], dir->nr - entry_index - 1); dir->nr--; if (dir->sorted > entry_index) dir->sorted--; |