51typedef struct _alpm_list_t {
61#define FREELIST(p) do { alpm_list_free_inner(p, free); alpm_list_free(p); p = NULL; } while(0)
struct _alpm_list_t * next
pointer to the next node
Definition alpm_list.h:57
struct _alpm_list_t * prev
pointer to the previous node
Definition alpm_list.h:55
void * data
data held by the list node
Definition alpm_list.h:53
void * alpm_list_to_array(const alpm_list_t *list, size_t n, size_t size)
Copy a list and data into a standard C array of fixed length.
Definition alpm_list.c:631
alpm_list_t * alpm_list_add(alpm_list_t *list, void *data)
Add a new item to the end of the list.
Definition alpm_list.c:64
alpm_list_t * alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn)
Add items to a list in sorted order.
Definition alpm_list.c:108
void(* alpm_list_fn_free)(void *item)
item deallocation callback.
Definition alpm_list.h:66
alpm_list_t * alpm_list_copy_data(const alpm_list_t *list, size_t size)
Copy a list and copy the data.
Definition alpm_list.c:380
alpm_list_t * alpm_list_previous(const alpm_list_t *list)
Get the previous element of a list.
Definition alpm_list.c:449
alpm_list_t * alpm_list_next(const alpm_list_t *list)
Get the next element of a list.
Definition alpm_list.c:440
size_t alpm_list_count(const alpm_list_t *list)
Get the number of items in a list.
Definition alpm_list.c:469
alpm_list_t * alpm_list_append_strdup(alpm_list_t **list, const char *data)
Duplicate and append a string to a list.
Definition alpm_list.c:96
alpm_list_t * alpm_list_remove_str(alpm_list_t *haystack, const char *needle, char **data)
Remove a string from a list.
Definition alpm_list.c:329
void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn)
Free the internal data of a list structure but not the list itself.
Definition alpm_list.c:47
alpm_list_t * alpm_list_nth(const alpm_list_t *list, size_t n)
Return nth element from list (starting from 0).
Definition alpm_list.c:431
alpm_list_t * alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data)
Remove an item from the list.
Definition alpm_list.c:295
void alpm_list_diff_sorted(const alpm_list_t *left, const alpm_list_t *right, alpm_list_fn_cmp fn, alpm_list_t **onlyleft, alpm_list_t **onlyright)
Find the differences between list left and list right
Definition alpm_list.c:569
char * alpm_list_find_str(const alpm_list_t *haystack, const char *needle)
Find a string in a list.
Definition alpm_list.c:505
alpm_list_t * alpm_list_reverse(alpm_list_t *list)
Create a new list in reverse order.
Definition alpm_list.c:403
alpm_list_t * alpm_list_strdup(const alpm_list_t *list)
Copy a string list, including data.
Definition alpm_list.c:352
alpm_list_t * alpm_list_diff(const alpm_list_t *lhs, const alpm_list_t *rhs, alpm_list_fn_cmp fn)
Find the items in list lhs that are not present in list rhs.
Definition alpm_list.c:613
alpm_list_t * alpm_list_join(alpm_list_t *first, alpm_list_t *second)
Join two lists.
Definition alpm_list.c:150
void * alpm_list_find(const alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn)
Find an item in a list.
Definition alpm_list.c:480
alpm_list_t * alpm_list_remove_item(alpm_list_t *haystack, alpm_list_t *item)
Remove an item from the list.
Definition alpm_list.c:258
int(* alpm_list_fn_cmp)(const void *, const void *)
item comparison callback
Definition alpm_list.h:69
void alpm_list_free(alpm_list_t *list)
Free a list, but not the contained data.
Definition alpm_list.c:36
alpm_list_t * alpm_list_last(const alpm_list_t *list)
Get the last item in the list.
Definition alpm_list.c:458
alpm_list_t * alpm_list_append(alpm_list_t **list, void *data)
Add a new item to the end of the list.
Definition alpm_list.c:70
alpm_list_t * alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn)
Sort a list of size n using mergesort algorithm.
Definition alpm_list.c:233
void * alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle)
Find an item in a list.
Definition alpm_list.c:499
int alpm_list_cmp_unsorted(const alpm_list_t *left, const alpm_list_t *right, alpm_list_fn_cmp fn)
Check if two lists contain the same data, ignoring order.
Definition alpm_list.c:512
alpm_list_t * alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn)
Merge the two sorted sublists into one sorted list.
Definition alpm_list.c:172
alpm_list_t * alpm_list_copy(const alpm_list_t *list)
Copy a list, without copying data.
Definition alpm_list.c:366
alpm_list_t * alpm_list_remove_dupes(const alpm_list_t *list)
Create a new list without any duplicates.
Definition alpm_list.c:336
A doubly linked list.
Definition alpm_list.h:51