Re: [PATCH] Use MOVE_ARRAY

2018-01-22 Thread Jeff King
On Mon, Jan 22, 2018 at 03:26:59PM -0800, Junio C Hamano wrote: > Jeff King writes: > > > Most of these are "shift part of the array". I wonder if it would make > > sense to encapsulate that pattern in a helper, like: > > > > #define SHIFT_ARRAY(a, nr, pos, slots) \ > > MOVE_ARRAY(a + pos

Re: [PATCH] Use MOVE_ARRAY

2018-01-22 Thread Junio C Hamano
Jeff King writes: > Most of these are "shift part of the array". I wonder if it would make > sense to encapsulate that pattern in a helper, like: > > #define SHIFT_ARRAY(a, nr, pos, slots) \ > MOVE_ARRAY(a + pos + slots, a + pos, nr - pos - slots) > ... > SHIFT_ARRAY(it->down, it->subtr

Re: [PATCH] Use MOVE_ARRAY

2018-01-22 Thread Jeff King
On Mon, Jan 22, 2018 at 06:50:09PM +0100, SZEDER Gábor wrote: > 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 buil

[PATCH] Use MOVE_ARRAY

2018-01-22 Thread SZEDER Gábor
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 --- cache-tree.c | 5 ++--- co