diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2018-01-22 17:50:09 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-01-22 19:32:51 (GMT) |
commit | f919ffebed3c570bf3c2a5f36444527ea5df42de (patch) | |
tree | 3d89f307b743c893848413a72d32b36e9fd8ec17 /read-cache.c | |
parent | 8279ed033f703d4115bee620dccd32a9ec94d9aa (diff) | |
download | git-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 'read-cache.c')
-rw-r--r-- | read-cache.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/read-cache.c b/read-cache.c index 2eb81a6..2e8c85c 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1217,9 +1217,8 @@ int add_index_entry(struct index_state *istate, struct cache_entry *ce, int opti /* Add it in.. */ istate->cache_nr++; if (istate->cache_nr > pos + 1) - memmove(istate->cache + pos + 1, - istate->cache + pos, - (istate->cache_nr - pos - 1) * sizeof(ce)); + MOVE_ARRAY(istate->cache + pos + 1, istate->cache + pos, + istate->cache_nr - pos - 1); set_index_entry(istate, pos, ce); istate->cache_changed |= CE_ENTRY_ADDED; return 0; |