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

Erik Andersen andersen at codepoet.org
Sun Jul 24 22:14:10 MDT 2005


On Sun Jul 24, 2005 at 08:50:39PM -0500, Rob Landley wrote:
> On Sunday 24 July 2005 12:32, Shaun Jackman wrote:
> > Ping?
> >
> > -- sdj
> 
> Hmmm...
> 
> The problem is I really hate adding extra #ifdefs, especially for something 
> that small.  For 1.0.1 this doesn't really need to be addressed at all, and 
> for 1.1 what would be really nice would be a general reorganization where we 
> have libbb.h have one #ifdef that set "do_cleanup" to 0 or 1, and then we 
> used if(do_cleanup) in the body of the code and let the compiler's dead code 
> elimination yank it for us...
> 
> 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

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--


More information about the busybox mailing list