diff options
author | Dan McGee <dan@archlinux.org> | 2011-02-03 03:46:28 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2011-02-04 00:55:46 +0100 |
commit | 14fd1e63a2ce420c555c6de34a815a8b62a9859b (patch) | |
tree | c7365b8f72e57f9c86ddb91aa8ee2e5660be6e8e /lib/libalpm/alpm_list.h | |
parent | 09e582b4117356f996f6d94ca5e490aebd0a0fd5 (diff) | |
download | pacman-14fd1e63a2ce420c555c6de34a815a8b62a9859b.tar.gz pacman-14fd1e63a2ce420c555c6de34a815a8b62a9859b.tar.xz |
Add new alpm_list_remove_item() function
This takes in the list and a list item, and does the pointer dance necessary
to remove it from the list regardless of whether it is first, last, or
somewhere in the middle. It is useful for callers that already know what
item needs to be removed and have a pointer to it rather than doing a search
by data that the plain alpm_list_remove() does.
Refactor alpm_list_remove() to use this function as well.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/alpm_list.h')
-rw-r--r-- | lib/libalpm/alpm_list.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libalpm/alpm_list.h b/lib/libalpm/alpm_list.h index ee85a5dd..1f6393a6 100644 --- a/lib/libalpm/alpm_list.h +++ b/lib/libalpm/alpm_list.h @@ -57,6 +57,7 @@ alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cm alpm_list_t *alpm_list_join(alpm_list_t *first, alpm_list_t *second); 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, size_t n, alpm_list_fn_cmp fn); +alpm_list_t *alpm_list_remove_item(alpm_list_t *haystack, alpm_list_t *item); alpm_list_t *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data); alpm_list_t *alpm_list_remove_str(alpm_list_t *haystack, const char *needle, char **data); alpm_list_t *alpm_list_remove_dupes(const alpm_list_t *list); |