From: Martin Mares Date: Mon, 16 Jan 2006 20:02:42 +0000 (+0000) Subject: xfree() macro has been turned into a regular function. This is much cleaner, X-Git-Tag: holmes-import~691 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=2ea7e85635ce6279e52634e807dad71a8ee7660a;p=libucw.git xfree() macro has been turned into a regular function. This is much cleaner, allows for easy memory allocation tracking and also avoids including at random places. --- diff --git a/lib/alloc.c b/lib/alloc.c index 59991316..678901a9 100644 --- a/lib/alloc.c +++ b/lib/alloc.c @@ -32,3 +32,14 @@ xmalloc_zero(uns size) bzero(x, size); return x; } + +void +xfree(void *ptr) +{ + /* + * Maybe it is a little waste of resources to make this a function instead + * of a macro, but xmalloc() is not used for anything critical anyway, + * so let's prefer simplicity. + */ + free(ptr); +} diff --git a/lib/lib.h b/lib/lib.h index 17944dbe..80090971 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -1,7 +1,7 @@ /* * The UCW Library -- Miscellaneous Functions * - * (c) 1997--2005 Martin Mares + * (c) 1997--2006 Martin Mares * (c) 2005 Tomas Valla * * This software may be freely distributed and used according to the terms @@ -139,7 +139,7 @@ static inline void log_switch_enable(void) { ASSERT(log_switch_nest); log_switch */ void *xmalloc(unsigned); void *xrealloc(void *, unsigned); -#define sh_xfree(x) free(x) +void xfree(void *); #endif void *xmalloc_zero(unsigned);