[Freeipa-devel] [PATCH] cleanups

Martin Nagy mnagy at redhat.com
Tue Jul 7 08:44:44 UTC 2009


On Mon, 06 Jul 2009 08:42:59 -0400, Dmitri Pal <dpal at redhat.com> wrote:
> I am just used to checking free(). In old times it was dangerous to
> free without checking.
> I do not know how porting to other platforms would go down the road.
> It might be that we would have to use other compiler on other
> platforms and it might not be as smart.

If we ever find ourselves in the need to use a platform as old as that,
we can always do something like this:

#define free(x) do { if ((x) != NULL) free(x); } while (0)

> Also I suspect that smart compiler probably optimizes the code so the
> duplicate checking is removed.

Hm.. Nope. Although I would expect as much. But this really isn't the
issue. A test like that is really not a performance concern. It's more
about having the code pretty.

Martin




More information about the Freeipa-devel mailing list