[PATCH] hdparm new option parsing
Tito
farmatito at tiscali.it
Mon May 8 11:53:11 UTC 2006
On Monday 8 May 2006 06:45, Rob Landley wrote:
> On Sunday 07 May 2006 3:28 pm, Tito wrote:
> > New version of the previous patch with the ENABLE_ and USE_ stuff.
> > Enjoy.
>
> Well, it's still a little ugly but it's better than what was there before (and
> make bloatcheck says it saves 1440 bytes), so I've applied it.
>
> Having a test as the first parameter of a function you call unconditionally is
> kinda ugly. Is having an extra parameter in the function actually cheaper
> than an if statement?
Seems yes if you think of a switch statement as
if(a == 1)
else if(a == 2)
else if(a == n)
else {
/* do the default */
}
This way you have only one if in the body of the function replacing some 30 of them.
Ciao,
Tito
> The best solution I can come up with off the top of my
> head is table driven and I haven't got time to go off on that tangent right
> now, so...
>
> Rob
More information about the busybox
mailing list