Re: [PATCH][RFC] kernel.h: provide array iterator

2018-03-17 Thread Kieran Bingham
Hi Joe, On 16/03/18 19:45, Joe Perches wrote: > On Fri, 2018-03-16 at 16:27 +0100, Rasmus Villemoes wrote: >> On 2018-03-15 11:00, Kieran Bingham wrote: >>> Simplify array iteration with a helper to iterate each entry in an array. >>> Utilise the existing ARRAY_SIZE macro to identify the length

Re: [PATCH][RFC] kernel.h: provide array iterator

2018-03-17 Thread Kieran Bingham
Hi Rasmus, On 16/03/18 16:27, Rasmus Villemoes wrote: > On 2018-03-15 11:00, Kieran Bingham wrote: >> Simplify array iteration with a helper to iterate each entry in an array. >> Utilise the existing ARRAY_SIZE macro to identify the length of the array >> and pointer arithmetic to process each

Re: [PATCH][RFC] kernel.h: provide array iterator

2018-03-16 Thread Alexey Dobriyan
Proper form for iteration over an array is below: int a[] = {1, 2, 3, 5}; for (int x: a) { ... } Your macro forces an iterator to be pointer which is uh-oh.

Re: [PATCH][RFC] kernel.h: provide array iterator

2018-03-16 Thread Joe Perches
On Fri, 2018-03-16 at 16:27 +0100, Rasmus Villemoes wrote: > On 2018-03-15 11:00, Kieran Bingham wrote: > > Simplify array iteration with a helper to iterate each entry in an array. > > Utilise the existing ARRAY_SIZE macro to identify the length of the array > > and pointer arithmetic to process

Re: [PATCH][RFC] kernel.h: provide array iterator

2018-03-16 Thread Rasmus Villemoes
On 2018-03-15 11:00, Kieran Bingham wrote: > Simplify array iteration with a helper to iterate each entry in an array. > Utilise the existing ARRAY_SIZE macro to identify the length of the array > and pointer arithmetic to process each item as a for loop. > > Signed-off-by: Kieran Bingham

Re: [PATCH][RFC] kernel.h: provide array iterator

2018-03-16 Thread Kieran Bingham
Hi Kees, Julia, On 16/03/18 07:41, Julia Lawall wrote: > Le 16.03.2018 05:21, Kees Cook a écrit : >> On Thu, Mar 15, 2018 at 3:00 AM, Kieran Bingham >> wrote: >>> Simplify array iteration with a helper to iterate each entry in an array. >>> Utilise the existing

Re: [PATCH][RFC] kernel.h: provide array iterator

2018-03-16 Thread Julia Lawall
Le 16.03.2018 05:21, Kees Cook a écrit : On Thu, Mar 15, 2018 at 3:00 AM, Kieran Bingham wrote: Simplify array iteration with a helper to iterate each entry in an array. Utilise the existing ARRAY_SIZE macro to identify the length of the array and pointer

Re: [PATCH][RFC] kernel.h: provide array iterator

2018-03-15 Thread Kees Cook
On Thu, Mar 15, 2018 at 3:00 AM, Kieran Bingham wrote: > Simplify array iteration with a helper to iterate each entry in an array. > Utilise the existing ARRAY_SIZE macro to identify the length of the array > and pointer arithmetic to process each item as a for

[PATCH][RFC] kernel.h: provide array iterator

2018-03-15 Thread Kieran Bingham
Simplify array iteration with a helper to iterate each entry in an array. Utilise the existing ARRAY_SIZE macro to identify the length of the array and pointer arithmetic to process each item as a for loop. Signed-off-by: Kieran Bingham ---