[BusyBox] uname patch and questions
Manuel Novoa III
mjn3 at busybox.net
Mon Nov 26 21:51:02 UTC 2001
Glenn,
On Tue, Nov 27, 2001 at 02:07:48PM +1100, Glenn McGrath wrote:
> "Manuel Novoa III" <mjn3 at busybox.net> wrote:
> > At some cost in readability, you can save more space by:
> > 1) Getting rid of the switch statement in arg processing.
>
> Thats a pretty good trick
I've found that switch statements can surprise you with how much
code they generate.
> > 2) Getting rid of the print_element function and its associated
> redundancy.
> >
> Wow, i had never even heard of offsetof, i was trying to think of a way
> of doing the same thing.
You might want to take a look at ifconfig.c or ash.c to see a couple of
more involved examples using offsetof().
> Looks very good, i should follow your code more often, i might learn
> some new tricks.
Thanks. ;-)
> The only thing i would change would be to declare utsname_offset[],
> options[] and flags[] inside uname_main() as that the only place they
> are used. Is there a reason not to, or is it just aesthetics ?
Just my style really. I tend to put static const tables outside of
function definitions.
One thing to fix though is the redundant initialization of "delta".
Remove the ininitialization in the declaration and keep the one in
the "for" loop.
Manuel
More information about the busybox
mailing list