diff options
author | Aaron Griffin <aaron@archlinux.org> | 2007-01-24 09:51:50 +0100 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2007-01-24 09:51:50 +0100 |
commit | 170d63190a3cfb0c12ee9ddfe07b21f20825bd6f (patch) | |
tree | c1cad21e75daf695f61f83ca1072d0a52343a673 /lib/libalpm/alpm_list.h | |
parent | 1b61cc8c69025ddd394401a506b21f16df5d4e6d (diff) | |
download | pacman-170d63190a3cfb0c12ee9ddfe07b21f20825bd6f.tar.gz pacman-170d63190a3cfb0c12ee9ddfe07b21f20825bd6f.tar.xz |
* 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
Diffstat (limited to 'lib/libalpm/alpm_list.h')
-rw-r--r-- | lib/libalpm/alpm_list.h | 13 |
1 files changed, 7 insertions, 6 deletions
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); |