svn commit: [25930] trunk/busybox/shell

Denys Vlasenko vda.linux at googlemail.com
Sat Apr 4 12:30:56 UTC 2009


On Thursday 02 April 2009 16:08, Mike Frysinger wrote:
> On Thursday 02 April 2009 09:46:28 vda at busybox.net wrote:
> > +ash_arith(const char *s)
> > +{
> > +	arith_eval_hooks_t math_hooks;
> > +	arith_t result;
> > +	int errcode = 0;
> > +
> > +	math_hooks.lookupvar = lookupvar;
> > +	math_hooks.setvar = setvar;
> > +	math_hooks.endofname = endofname;
> 
> might read simpler as:
> arith_eval_hooks_t math_hooks = {
> 	.lookupvar = lookupvar,
> 	.setvar = setvar,
> 	.endofname = endofname,
> };
> same for hush

I'm a bit reluctant to use struct initializers.
gcc sometimes does atrocious things, like creating
a constant copy of this struct and memcpy'ing it,
when memset or just assignments would be better.

We used to have 0.5k of .data in hdparm just because of this.
--
vda


More information about the busybox mailing list