[BusyBox] Clean up

Tito farmatito at tiscali.it
Wed Jul 27 00:57:44 UTC 2005


On Tuesday 26 July 2005 23:56, Erik Andersen wrote:
> On Tue Jul 26, 2005 at 11:36:35PM +0200, Tito wrote:
> > Hi, 
> > one more funny solution:
> > 
> > /* in config.h */
> > #define CONFIG_FEATURE_CLEAN_UP
> > 
> > /* in busybox.h ? */
> > #ifdef CONFIG_FEATURE_CLEAN_UP
> > 
> > #include <stdio.h>    /* maybe not needed  */
> > #include <unistd.h>  /* maybe not needed  */
> > #include <stdlib.h>   /* maybe not needed  */
> > 
> > #define clean_up_free(x)            free(x)
> > #define clean_up_close(x)         close(x)
> > #define clean_up_fclose(x)        fclose(x)
> > /* something else needed here ? */
> > 
> > #else
> > #define clean_up_free(x)
> > #define clean_up_close(x)
> > #define clean_up_fclose(x)
> > #endif
> 
> That works too, though I'd prefer implementing such a thing
> using static inline functions to avoid the potential for macro
> expansion bugs...
> 
> i.e....
> 
> #ifdef CONFIG_FEATURE_CLEAN_UP
>     static inline void clean_up_free(void *foo) { free(foo); }
> #else
>     static inline void clean_up_free(void *foo) { }
> #endif
> 
>  -Erik
> 
> --
> Erik B. Andersen             http://codepoet-consulting.com/
> --This message was written using 73% post-consumer electrons--
> 
Hi,
Should I try a to write a patch using this solution?
And if yes for 1.0.1 or 1.1?

Ciao,
Tito



More information about the busybox mailing list