[BusyBox] Re: ifconfig: Clean up. [PATCH]

Tito farmatito at tiscali.it
Mon Jul 25 08:08:58 MDT 2005


On Monday 25 July 2005 10:03, Rob Landley wrote:
> On Monday 25 July 2005 01:24, Tito wrote:
> > On Monday 25 July 2005 06:14, Erik Andersen wrote:
> > > On Sun Jul 24, 2005 at 08:50:39PM -0500, Rob Landley wrote:
> > > > On Sunday 24 July 2005 12:32, Shaun Jackman wrote:
> > > > Opinions?
> > >
> > > I think we need to have a #define in the busybox header file
> > > such as:
> > >
> > >     #ifdef CONFIG_FEATURE_CLEAN_UP
> > >     # define #do_cleanup 1
> > >     #else
> > >     # define #do_cleanup 0
> > >     #endif
> > >
> > > and then applet code will simply do:
> > >
> > >     if (do_cleanup)
> > >     {
> > >  // Stuff
> > >     }
> > >
> > > such that the entire block of code will be pruned by gcc when
> > > do_cleanup is 0...  A similar approach could also be used to
> > > remove a number of other #defines.
> > >
> > >  -Erik
> >
> > Hi, i personally am all for the macro solution for just
> > one simple reason:
> >
> > macro = 1 line of code
> >
> > define = at least (if correctly indented) 3 lines.
> 
>   if(do_cleanup) close(fd);
> 
> Rob
> 
Hi,
From busybox/docs/style-guide.txt:

Brackets Are Your Friends
~~~~~~~~~~~~~~~~~~~~~~~~~

Please use brackets on all if and else statements, even if it is only one
line. Example:

	Don't do this:

		if (foo)
			stmt1;
		stmt2
		stmt3;

	Do this instead:

		if (foo) {
			stmt1;
		}
		stmt2
		stmt3;

Ciao,
Tito


More information about the busybox mailing list