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

Shaun Jackman sjackman at gmail.com
Mon Jul 25 05:28:24 UTC 2005


On 7/24/05, Erik Andersen <andersen at codepoet.org> wrote:
> 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
...

An idea entered my mind...

/* Uncomment one of these. */
/* #define CONFIG_FEATURE_CLEAN_UP 1 */
/* #undef CONFIG_FEATURE_CLEAN_UP */
#ifndef CONFIG_FEATURE_CLEAN_UP
  const int CONFIG_FEATURE_CLEAN_UP = 0;
#endif

This would allow either
	#ifdef CONFIG_FEATURE_CLEAN_UP
or
	if (CONFIG_FEATURE_CLEAN_UP)
to be used.

I'm not sure what I think about this trick, but it is easily extended
to any number of CONFIG_xxx options without having to invent a new
do_xxx name for each of them.

I'd to spell do_cleanup as DO_CLEANUP. If I saw...
	if (DO_CLEANUP)
... I'd understand it was a conditional compilation. If I saw...
	if (do_cleanup)
... I'd start looking for the definition of do_cleanup and where it
was last modified.

Cheers,
Shaun



More information about the busybox mailing list