From: Jaakko Heinonen Date: Fri, 29 Jul 2005 05:53:10 +0000 (+0000) Subject: - fix xfree X-Git-Tag: upstream/0.6.1~2^2~197 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=75633ffa7a52aec7958b5cf4e0f3375683851c65;p=pkg%2Fabook.git - fix xfree --- diff --git a/edit.c b/edit.c index 7a4004a..ebabf1a 100644 --- a/edit.c +++ b/edit.c @@ -227,7 +227,7 @@ change_field(char *msg, char **field) *field = ui_readline(msg, old, max_len - 1, 0); if(*field) { - free(old); + xfree(old); if(!**field) xfree(*field); } else { diff --git a/xmalloc.c b/xmalloc.c index bc22a97..e767584 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -134,10 +134,3 @@ xrealloc_inc(void *ptr, size_t size, size_t inc) return ptr; } -void -xfree(void *ptr) -{ - free(ptr); - ptr = NULL; -} - diff --git a/xmalloc.h b/xmalloc.h index c6c5317..61e25c2 100644 --- a/xmalloc.h +++ b/xmalloc.h @@ -9,6 +9,7 @@ void * xmalloc0(size_t); void * xmalloc_inc(size_t, size_t); void * xrealloc(void *, size_t); void * xrealloc_inc(void *, size_t, size_t); -void xfree(void *); + +#define xfree(ptr) do { free(ptr); ptr = NULL; } while(0) #endif