On Sun, 17 Dec 2006, Randy Dunlap wrote:
> On Sun, 17 Dec 2006 13:13:59 -0500 (EST) Robert P. J. Day wrote:
>
> >
> > so here's the end result of my experiment to replace unnecessary
> > code snippets with an invocation of the ARRAY_SIZE() macro from
> > include/linux/kernel.h. i've attached th
On Sun, 17 Dec 2006 13:13:59 -0500 (EST) Robert P. J. Day wrote:
>
> so here's the end result of my experiment to replace unnecessary
> code snippets with an invocation of the ARRAY_SIZE() macro from
> include/linux/kernel.h. i've attached the script that i ran on the
> entire tree, then (afte
so here's the end result of my experiment to replace unnecessary
code snippets with an invocation of the ARRAY_SIZE() macro from
include/linux/kernel.h. i've attached the script that i ran on the
entire tree, then (after adding al viro's connector patch), did:
$ make allyesconfig # for the
Jan Engelhardt wrote:
> On Dec 16 2006 08:09, Robert P. J. Day wrote:
>> On Sat, 16 Dec 2006, Pavel Machek wrote:
but we already have, from "include/linux/kernel.h":
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>>> Hmmm. quite misleading name :-(. ARRAY_LEN would be better.
On Dec 16 2006 08:09, Robert P. J. Day wrote:
>On Sat, 16 Dec 2006, Pavel Machek wrote:
>> > but we already have, from "include/linux/kernel.h":
>> >
>> > #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>>
>> Hmmm. quite misleading name :-(. ARRAY_LEN would be better.
>
>i suspect it's *way*
(i'm not *trying* to belabour this issue ... i am merely succeeding)
On Sat, 16 Dec 2006, Tim Schmielau wrote:
> On Sat, 16 Dec 2006, Robert P. J. Day wrote:
...
> > ... it's amazing the variation that you find beyond the obvious:
> >
> > $ grep -Er "sizeof.*/.*sizeof" . | less
> >
> > ...
> > .
On Sat, 16 Dec 2006, Robert P. J. Day wrote:
> On Fri, 15 Dec 2006, Tim Schmielau wrote:
> >
> > It might be interesting to grep for anything that divides two
> > sizeofs and eyeball the result for possible mistakes. This would
> > provide some real benefit beyond the cosmetical changes.
>
> i did
On Sat, 16 Dec 2006, Pavel Machek wrote:
> Hi!
>
> > there are numerous places throughout the source tree that apparently
> > calculate the size of an array using the construct
> > "sizeof(fubar)/sizeof(fubar[0])". see for yourself:
> >
> > $ grep -Er "sizeof\((.*)\) ?/ ?sizeof\(\1\[0\]\)" *
>
On Fri, 15 Dec 2006, Tim Schmielau wrote:
> On Fri, 15 Dec 2006, Robert P. J. Day wrote:
> > On Fri, 15 Dec 2006, Jan Engelhardt wrote:
> > > Even sizeof a / sizeof *a
> > >
> > > may happen.
> >
> > yes, sadly, there are a number of those as well. back to the drawing
> > board.
>
> It might be
Hi!
> there are numerous places throughout the source tree that apparently
> calculate the size of an array using the construct
> "sizeof(fubar)/sizeof(fubar[0])". see for yourself:
>
> $ grep -Er "sizeof\((.*)\) ?/ ?sizeof\(\1\[0\]\)" *
>
> but we already have, from "include/linux/kernel.h"
On Fri, 15 Dec 2006, Robert P. J. Day wrote:
> On Fri, 15 Dec 2006, Jan Engelhardt wrote:
> > Even sizeof a / sizeof *a
> >
> > may happen.
>
> yes, sadly, there are a number of those as well. back to the drawing
> board.
It might be interesting to grep for anything that divides two sizeofs and
On Fri, 15 Dec 2006, Jan Engelhardt wrote:
>
> >>> Indeed, there seems to be lots of potential clean-up there.
> >>> Including duplicate macros like:
> >>>
> >>> ./drivers/ide/ide-cd.h:#define ARY_LEN(a) ((sizeof(a) / sizeof(a[0])))
> >>
> >> not surprisingly, i have a script "arraysize.sh":
> >..
>>> Indeed, there seems to be lots of potential clean-up there.
>>> Including duplicate macros like:
>>>
>>> ./drivers/ide/ide-cd.h:#define ARY_LEN(a) ((sizeof(a) / sizeof(a[0])))
>>
>> not surprisingly, i have a script "arraysize.sh":
>...
>
>This could also come in the flavor "sizeof(a) / sizeo
On Fri, 15 Dec 2006, Miguel Ojeda wrote:
> On 12/13/06, Robert P. J. Day <[EMAIL PROTECTED]> wrote:
> >
> > there are numerous places throughout the source tree that apparently
> > calculate the size of an array using the construct
> > "sizeof(fubar)/sizeof(fubar[0])". see for yourself:
> >
> >
On 12/13/06, Robert P. J. Day <[EMAIL PROTECTED]> wrote:
there are numerous places throughout the source tree that apparently
calculate the size of an array using the construct
"sizeof(fubar)/sizeof(fubar[0])". see for yourself:
$ grep -Er "sizeof\((.*)\) ?/ ?sizeof\(\1\[0\]\)" *
but we al
Robert P. J. Day wrote:
> On Thu, 14 Dec 2006, Zach Brown wrote:
...
>> Indeed, there seems to be lots of potential clean-up there.
>> Including duplicate macros like:
>>
>> ./drivers/ide/ide-cd.h:#define ARY_LEN(a) ((sizeof(a) / sizeof(a[0])))
>
> not surprisingly, i have a script "arraysize.sh":
On Thu, 14 Dec 2006, Zach Brown wrote:
> > there are numerous places throughout the source tree that
> > apparently calculate the size of an array using the construct
> > "sizeof(fubar)/sizeof(fubar[0])". see for yourself:
> > $ grep -Er "sizeof\((.*)\) ?/ ?sizeof\(\1\[0\]\)" *
>
> Indeed, ther
there are numerous places throughout the source tree that apparently
calculate the size of an array using the construct
"sizeof(fubar)/sizeof(fubar[0])". see for yourself:
$ grep -Er "sizeof\((.*)\) ?/ ?sizeof\(\1\[0\]\)" *
but we already have, from "include/linux/kernel.h":
#define ARRAY
18 matches
Mail list logo