[ccan] [PATCH 2/2] darray: Evaluate the index parameter only once in darray_remove()

2017-08-26 Thread Damien Grassart
To be consistent with the rest of the code, the index paramater should not be evaluated multiple times. Calling this with rand() % arr.size would otherwise generally segfault. --- ccan/darray/darray.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ccan/darray/darray.h

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

2017-08-26 Thread Damien Grassart
The memmove() call should be using the index argument to determine the number of bytes to copy. Signed-off-by: Damien Grassart <dam...@grassart.com> --- ccan/darray/darray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccan/darray/darray.h b/ccan/darray/darray.h

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

2017-08-27 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 <dam...@grassart.com> --- ccan/darray/darray.h | 68 ++-- 1 file changed, 34 inse

Re: [ccan] [PATCH 1/2] darray: Fix bug in the darray_remove() macro

2017-08-27 Thread Damien Grassart
Good point about shadowing index(3), I'll send a patch renaming all the uses of 'index'. On Sun, Aug 27, 2017 at 4:56 AM, David Gibson <da...@gibson.dropbear.id.au> wrote: > On Sat, Aug 26, 2017 at 06:26:20PM +0200, Damien Grassart wrote: > > The memmove() call should be using the

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

2017-08-27 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 <dam...@grassart.com> --- ccan/darray/darray.h | 7 +++

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

2017-08-27 Thread Damien Grassart
Gibson <da...@gibson.dropbear.id.au> wrote: > On Sun, Aug 27, 2017 at 11:26:24PM +0200, Damien Grassart wrote: > > 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

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

2017-08-27 Thread Damien Grassart
to avoid using "index" as an identifier so as to not shadow index(3) in the C library. Signed-off-by: Damien Grassart <dam...@grassart.com> --- ccan/darray/darray.h | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ccan/darray/darray.h b/ccan/darra

[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 <dam...@grassart.com> --- ccan/darray/darray.h | 7 +++

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

2017-08-29 Thread Damien Grassart
to avoid using "index" as an identifier so as to not shadow index(3) in the C library. Signed-off-by: Damien Grassart <dam...@grassart.com> --- ccan/darray/darray.h | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ccan/darray/darray.h b/ccan/darra

[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 <dam...@grassart.com> --- ccan/darray/darray.h | 68 ++-- 1 file changed, 34 inse