summaryrefslogtreecommitdiff
path: root/lib/libalpm/list.h
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-03-28 07:45:24 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-03-28 07:45:24 +0000
commit0ef95757d6fed29b99d1ea08b78732b2a7fe0e2c (patch)
tree533229e29f3d37f6cad859b97cc2d2d9b2dce6fd /lib/libalpm/list.h
parent350a3972d1d372a009c67aba5af4ff0d3e25e813 (diff)
downloadpacman-0ef95757d6fed29b99d1ea08b78732b2a7fe0e2c.tar.xz
added a FREELISTPTR macro to free a PMList without freeing its data
Diffstat (limited to 'lib/libalpm/list.h')
-rw-r--r--lib/libalpm/list.h10
1 files changed, 10 insertions, 0 deletions
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 *);