[BusyBox] xfuncts.c xfree() ?

Axel Kittenberger Axel.Kittenberger at maxxio.at
Wed Dec 5 00:28:16 UTC 2001


> We could have something like
>
> extern void xfree(void *var)
> {
> #ifdef DODEBUG
> 	if (var)
> #endif
> 		free(var);
> }
>
> And pass DODEBUG from the root Makefile
>
> What do you think ?

I agree in 'MALLOC_TRACE's free(0) shows up as an error :(

Only technically I would find following preferable:

#define xfree(var)  do { if (!DODEBUG || (var)) free(var); } while (0)

* Macro uses no additional stack frame
* if (1 || x) gets optimized away from any compiler.

- Axel






More information about the busybox mailing list