[BusyBox] Clean up

Tito farmatito at tiscali.it
Tue Jul 26 13:29:14 UTC 2005


Hi,
This is just a horrible solution for the clean up problem but:

1) it allows multiline blocks
2) the code is not compiled if the config option is not set
3) doesn't need an if 
4) doesn't need variables to be set
5) it looks bad
6) nobody will like it.

in config.h

#define CONFIG_FEATURE_CLEAN_UP

in busybox.h

#ifdef CONFIG_FEATURE_CLEAN_UP 
#define CLEAN_UP(x)		x
#else
#define CLEAN_UP(x)
#endif

So in the ifconfig.c case it would look like:

> --- networking/ifconfig.c
> +++ networking/ifconfig.c
> @@ -558,6 +558,9 @@
>                 continue;
>         }                                       /* end of while-loop */
> 
> +CLEAN_UP(close(sockfd));
>         return goterr;
>  }

CAVEAT: This is untested and maybe doesn't work at all,
                 just an idea.
                 If somebody is interested I can try if it work.
                 if somebody knows that it doesn't work please 
                 tell me, so I'll learn the lesson and spare time.

Ciao,
Tito



More information about the busybox mailing list