[BusyBox] Clean up

Mike Frysinger vapier at gentoo.org
Wed Jul 27 01:59:30 UTC 2005


On Tuesday 26 July 2005 10:09 am, Jason Schoon wrote:
> That was basically my original idea, but Rob pointed out that
> multiline blocks are really messy in that scenario.
>
> I think from a preprocessor and compiler standpoint it is all cool,
> but you will make some people scratch their heads the first time they
> see:
>
> CLEAN_UP({free(foo); close(sockfd)});
>
> Curly braces inside of parens just isn't something you generally see.

you dont need that if you do CLEAN_UP right:
#ifdef CONFIG_FEATURE_CLEAN_UP
# define CLEAN_UP(x) do { x; } while (0)
#else
# define CLEAN_UP(x)
#endif

then the following works just fine:
CLEAN_UP(
    free(foo);
    close(sockfd);
);
-mike



More information about the busybox mailing list