Re: Coding style RFC: convert "for (i=0;i

2007-02-13 Thread Randy Dunlap
On Tue, 13 Feb 2007 09:37:38 +0200 Muli Ben-Yehuda wrote: > On Mon, Feb 12, 2007 at 03:47:50PM -0800, Joe Perches wrote: > > > Now that most of the sizeof(array)/sizeof(array[0]) conversions have > > been done (there are about 800 done and about another 130 left), > > perhaps it could be useful

Re: Coding style RFC: convert "for (i=0;i

2007-02-13 Thread Bernd Petrovitsch
On Tue, 2007-02-13 at 21:54 +1100, Nick Piggin wrote: > Bernd Petrovitsch wrote: > > On Tue, 2007-02-13 at 18:42 +1100, Nick Piggin wrote: > > > >>Joe Perches wrote: > > > > [...] > > > >>>perhaps: > >>> > >>>#define array_for_each(element, array) \ > >>> for ((element) = (array); \ > >>>

Re: Coding style RFC: convert "for (i=0;i

2007-02-13 Thread Nick Piggin
Bernd Petrovitsch wrote: On Tue, 2007-02-13 at 18:42 +1100, Nick Piggin wrote: Joe Perches wrote: [...] perhaps: #define array_for_each(element, array) \ for ((element) = (array); \ (element) < ((array) + ARRAY_SIZE((array))); \ (element)++) If you're

Re: Coding style RFC: convert "for (i=0;i

2007-02-13 Thread Bernd Petrovitsch
On Tue, 2007-02-13 at 18:42 +1100, Nick Piggin wrote: > Joe Perches wrote: [...] > > perhaps: > > > > #define array_for_each(element, array) \ > > for ((element) = (array); \ > > (element) < ((array) + ARRAY_SIZE((array))); \ > > (element)++) > > If you're going for

Re: Coding style RFC: convert "for (i=0;i

2007-02-12 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Mon, 12 Feb 2007 15:47:50 -0800), Joe Perches <[EMAIL PROTECTED]> says: > Now that most of the sizeof(array)/sizeof(array[0]) > conversions have been done (there are about 800 done > and about another 130 left), perhaps it could be > useful to change the code

Re: Coding style RFC: convert "for (i=0;i

2007-02-12 Thread Nick Piggin
Joe Perches wrote: On Tue, 2007-02-13 at 15:19 +1100, Nick Piggin wrote: #define array_for_each(element, array) \ for (int __idx = 0; __idx < ARRAY_SIZE((array)); \ __idx++, (element) = &(array[__idx])) If you really wanted to introduce your loop, then please call it

Re: Coding style RFC: convert "for (i=0;i

2007-02-12 Thread Muli Ben-Yehuda
On Mon, Feb 12, 2007 at 03:47:50PM -0800, Joe Perches wrote: > Now that most of the sizeof(array)/sizeof(array[0]) conversions have > been done (there are about 800 done and about another 130 left), > perhaps it could be useful to change the code to use a define > similar to the list_for_each >

Re: Coding style RFC: convert "for (i=0;i

2007-02-12 Thread Joe Perches
On Tue, 2007-02-13 at 15:19 +1100, Nick Piggin wrote: > >> #define array_for_each(element, array) \ > >>for (int __idx = 0; __idx < ARRAY_SIZE((array)); \ > >>__idx++, (element) = &(array[__idx])) > If you really wanted to introduce your loop, then please call it >

Re: Coding style RFC: convert "for (i=0;i

2007-02-12 Thread Nick Piggin
Joe Perches wrote: On Tue, 2007-02-13 at 11:20 +1100, Ben Nizette wrote: #define array_for_each(element, array) \ for (int __idx = 0; __idx < ARRAY_SIZE((array)); \ __idx++, (element) = &(array[__idx])) This requires all interior loop code be changed. Ben is right

Re: Coding style RFC: convert "for (i=0;i

2007-02-12 Thread Joe Perches
On Tue, 2007-02-13 at 11:20 +1100, Ben Nizette wrote: > #define array_for_each(element, array) \ > for (int __idx = 0; __idx < ARRAY_SIZE((array)); \ > __idx++, (element) = &(array[__idx])) This requires all interior loop code be changed. - To unsubscribe from this list:

Re: Coding style RFC: convert "for (i=0;i

2007-02-12 Thread Ben Nizette
Joe Perches wrote: Now that most of the sizeof(array)/sizeof(array[0]) conversions have been done (there are about 800 done and about another 130 left), perhaps it could be useful to change the code to use a define similar to the list_for_each #define list_for_each(pos, head) \ for (pos

Coding style RFC: convert "for (i=0;i

2007-02-12 Thread Joe Perches
Now that most of the sizeof(array)/sizeof(array[0]) conversions have been done (there are about 800 done and about another 130 left), perhaps it could be useful to change the code to use a define similar to the list_for_each #define list_for_each(pos, head) \ for (pos = (head)->next;