mirror of
https://github.com/git/git.git
synced 2026-04-12 01:40:10 +02:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
8279ed033f
commit
f919ffebed
@@ -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--;
|
||||
|
||||
Reference in New Issue
Block a user