]> git.ipfire.org Git - thirdparty/git.git/commit - string-list.c
use MOVE_ARRAY
authorRené Scharfe <l.s.r@web.de>
Sat, 15 Jul 2017 20:00:45 +0000 (22:00 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Jul 2017 21:54:56 +0000 (14:54 -0700)
commitf331ab9d4cb21942dcde6d879aaca6a1784e8cb6
tree64203c98b322d7b468b2649df734a2a3ea443fc1
parent578398071e45d296c3dc1de10acdbc15365e763f
use MOVE_ARRAY

Simplify the code for moving members inside of an array and make it more
robust by using the helper macro MOVE_ARRAY.  It calculates the size
based on the specified number of elements for us and supports NULL
pointers when that number is zero.  Raw memmove(3) calls with NULL can
cause the compiler to (over-eagerly) optimize out later NULL checks.

This patch was generated with contrib/coccinelle/array.cocci and spatch
(Coccinelle).

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-files.c
builtin/merge.c
builtin/pack-objects.c
cache-tree.c
commit.c
notes-merge.c
read-cache.c
reflog-walk.c
string-list.c