From 170d63190a3cfb0c12ee9ddfe07b21f20825bd6f Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Wed, 24 Jan 2007 08:51:50 +0000 Subject: * Shuffled some of the alpm_list free funtions - still not perfect, but better * Added alpm_list_remove_node for single list node removal * Proper error checking/output for failed db_read/db_write (missing files) * Invalid packages (missing files) are now removed from the package cache * -Qs and -Ss output now look the same * config.rpath causes errors on one machine I had, so I added it to CVS * Fixed a "clobbered memory" issue when installing groups - only the outer list should be free'd, not the contained data --- lib/libalpm/alpm_list.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/libalpm/alpm_list.h') diff --git a/lib/libalpm/alpm_list.h b/lib/libalpm/alpm_list.h index df19c9e9..5bad4dc2 100644 --- a/lib/libalpm/alpm_list.h +++ b/lib/libalpm/alpm_list.h @@ -30,18 +30,18 @@ struct __alpm_list_t { struct __alpm_list_t *next; }; -/* TODO we should do away with these... they're messy */ -#define _FREELIST(p, f) do { if(p) { alpm_list_free(p, f); p = NULL; } } while(0) -#define FREELIST(p) _FREELIST(p, free) -#define FREELISTPTR(p) _FREELIST(p, NULL) +/* TODO we should do away with these... they're messy*/ +#define _FREELIST(p, f) do { alpm_list_free_inner(p, f); alpm_list_free(p); p = NULL; } while(0) +#define FREELIST(p) _FREELIST(p, free) +#define FREELISTPTR(p) do { alpm_list_free(p); p = NULL; } while(0) typedef void (*alpm_list_fn_free)(void *); /* item deallocation callback */ typedef int (*alpm_list_fn_cmp)(const void *, const void *); /* item comparison callback */ /* allocation */ alpm_list_t *alpm_list_new(void); -void alpm_list_free(alpm_list_t *list, alpm_list_fn_free fn); -void alpm_list_free_outer(alpm_list_t *list); +void alpm_list_free(alpm_list_t *list); +void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn); /* item mutators */ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data); @@ -49,6 +49,7 @@ alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cm alpm_list_t* alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn); alpm_list_t* alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn); alpm_list_t *alpm_list_remove(alpm_list_t *haystack, void *needle, alpm_list_fn_cmp fn, void **data); +alpm_list_t *alpm_list_remove_node(alpm_list_t *node); alpm_list_t *alpm_list_remove_dupes(alpm_list_t *list); alpm_list_t *alpm_list_strdup(alpm_list_t *list); alpm_list_t *alpm_list_reverse(alpm_list_t *list); -- cgit v1.2.3-24-g4f1b