From 0ef95757d6fed29b99d1ea08b78732b2a7fe0e2c Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Mon, 28 Mar 2005 07:45:24 +0000 Subject: added a FREELISTPTR macro to free a PMList without freeing its data --- lib/libalpm/list.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/libalpm/list.h') diff --git a/lib/libalpm/list.h b/lib/libalpm/list.h index e7c9eb31..734a53d5 100644 --- a/lib/libalpm/list.h +++ b/lib/libalpm/list.h @@ -32,6 +32,16 @@ typedef struct __pmlist_t { typedef struct __pmlist_t PMList; #define FREELIST(p) do { if(p) { pm_list_free(p); p = NULL; } } while(0) +#define FREELISTPTR(p) do { \ + if(p) { \ + PMList *i; \ + for(i = p; i; i = i->next) { \ + i->data = NULL; \ + } \ + pm_list_free(p); \ + p = NULL; \ + } \ +} while(0) /* Sort comparison callback function declaration */ typedef int (*pm_fn_cmp) (const void *, const void *); -- cgit v1.2.3-24-g4f1b