1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#ifndef _ALPM_LIST_H
#define _ALPM_LIST_H
#include "alpm.h"
struct __alpm_list_t {
void *data;
struct __alpm_list_t *prev;
struct __alpm_list_t *next;
};
TODO
#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)
typedef void (*alpm_list_fn_free)(void *);
typedef int (*alpm_list_fn_cmp)(const void *, const void *);
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);
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data);
alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn);
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_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);
alpm_list_t *alpm_list_first(alpm_list_t *list);
alpm_list_t* alpm_list_nth(alpm_list_t *list, int n);
alpm_list_t *alpm_list_next(alpm_list_t *list);
alpm_list_t *alpm_list_last(alpm_list_t *list);
void *alpm_list_getdata(const alpm_list_t *entry);
#define alpm_list_data(type, list) (type)alpm_list_getdata((list))
int alpm_list_count(const alpm_list_t *list);
int alpm_list_is_in(const void *needle, alpm_list_t *haystack);
int alpm_list_is_strin(const char *needle, alpm_list_t *haystack);
#endif
|