[ccan] [PATCH 1/3] darray: Add darray_insert() to insert a value at a specified index

2017-08-29 Thread Damien Grassart
This module currently supports removing but not inserting at a specified index, so this adds that along with some tests. Inserting a value moves all existing data beyond index over one element. Signed-off-by: Damien Grassart --- ccan/darray/darray.h | 7 +++

[ccan] [PATCH 3/3] darray: Fix bug in the darray_remove() macro

2017-08-29 Thread Damien Grassart
The memmove() call should be using the index argument to determine the number of bytes to copy. To be consistent with the rest of the code, we should also not evaluate the index parameter multiple times. Calling this with rand() % arr.size would otherwise generally segfault. Finally, we want to

[ccan] [PATCH 2/3] darray: Rename identifiers starting with an underscore

2017-08-29 Thread Damien Grassart
Identifiers starting with underscores are technically reserved for system use, so rename all of them to end with one instead. Signed-off-by: Damien Grassart --- ccan/darray/darray.h | 68 ++-- 1 file changed, 34 insertions(+),

Re: [ccan] [PATCH 1/3] darray: Add darray_insert() to insert a value at a specified index

2017-08-29 Thread David Gibson
On Tue, Aug 29, 2017 at 12:08:40PM +0200, Damien Grassart wrote: > This module currently supports removing but not inserting at a > specified index, so this adds that along with some tests. Inserting a > value moves all existing data beyond index over one element. > > Signed-off-by: Damien