00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _ALPM_LIST_H
00020 #define _ALPM_LIST_H
00021
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025
00026
00027
00028
00029
00030
00031
00032
00033 typedef struct __alpm_list_t {
00034
00035 void *data;
00036
00037 struct __alpm_list_t *prev;
00038
00039 struct __alpm_list_t *next;
00040 } alpm_list_t;
00041
00042 #define FREELIST(p) do { alpm_list_free_inner(p, free); alpm_list_free(p); p = NULL; } while(0)
00043
00044 typedef void (*alpm_list_fn_free)(void *);
00045 typedef int (*alpm_list_fn_cmp)(const void *, const void *);
00046
00047
00048 alpm_list_t *alpm_list_new(void);
00049 void alpm_list_free(alpm_list_t *list);
00050 void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn);
00051
00052
00053 alpm_list_t *alpm_list_add(alpm_list_t *list, void *data);
00054 alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn);
00055 alpm_list_t *alpm_list_join(alpm_list_t *first, alpm_list_t *second);
00056 alpm_list_t *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn);
00057 alpm_list_t *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn);
00058 alpm_list_t *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data);
00059 alpm_list_t *alpm_list_remove_dupes(const alpm_list_t *list);
00060 alpm_list_t *alpm_list_strdup(const alpm_list_t *list);
00061 alpm_list_t *alpm_list_copy(const alpm_list_t *list);
00062 alpm_list_t *alpm_list_copy_data(const alpm_list_t *list, size_t size);
00063 alpm_list_t *alpm_list_reverse(alpm_list_t *list);
00064
00065
00066 alpm_list_t *alpm_list_first(const alpm_list_t *list);
00067 alpm_list_t *alpm_list_nth(const alpm_list_t *list, int n);
00068 alpm_list_t *alpm_list_next(const alpm_list_t *list);
00069 alpm_list_t *alpm_list_last(const alpm_list_t *list);
00070 void *alpm_list_getdata(const alpm_list_t *entry);
00071
00072
00073 int alpm_list_count(const alpm_list_t *list);
00074 void *alpm_list_find(const alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn);
00075 void *alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle);
00076 char *alpm_list_find_str(const alpm_list_t *haystack, const char *needle);
00077 alpm_list_t *alpm_list_diff(const alpm_list_t *lhs, const alpm_list_t *rhs, alpm_list_fn_cmp fn);
00078
00079 #ifdef __cplusplus
00080 }
00081 #endif
00082 #endif
00083
00084