From 14fd1e63a2ce420c555c6de34a815a8b62a9859b Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 2 Feb 2011 20:46:28 -0600 Subject: 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 --- lib/libalpm/alpm_list.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/libalpm/alpm_list.h') 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); -- cgit v1.2.3-24-g4f1b