Last change
on this file since e9b0027 was
15200be,
checked in by Mike Ryan <mikeryan@…>, 14 years ago
|
move libabac into its own directory
|
-
Property mode set to
100644
|
File size:
875 bytes
|
Line | |
---|
1 | #ifndef __LIST_H__ |
---|
2 | #define __LIST_H__ |
---|
3 | |
---|
4 | #include "utlist.h" |
---|
5 | |
---|
6 | typedef struct _abac_list_t abac_list_t; |
---|
7 | typedef struct _abac_list_element_t abac_list_element_t; |
---|
8 | |
---|
9 | struct _abac_list_element_t { |
---|
10 | void *ptr; |
---|
11 | abac_list_element_t *prev, *next; |
---|
12 | }; |
---|
13 | |
---|
14 | struct _abac_list_t { |
---|
15 | abac_list_element_t *elts; |
---|
16 | int size; |
---|
17 | }; |
---|
18 | |
---|
19 | abac_list_t *abac_list_new(void); |
---|
20 | void abac_list_add(abac_list_t *list, void *elt); |
---|
21 | int abac_list_remove(abac_list_t *list, void *elt); |
---|
22 | int abac_list_size(abac_list_t *list); |
---|
23 | void abac_list_free(abac_list_t *list); |
---|
24 | |
---|
25 | #define abac_list_foreach(LIST, CURRENT, BODY) do { \ |
---|
26 | abac_list_element_t *_elt; \ |
---|
27 | DL_FOREACH(LIST->elts, _elt) { \ |
---|
28 | CURRENT = (typeof(CURRENT))_elt->ptr; \ |
---|
29 | BODY \ |
---|
30 | } \ |
---|
31 | } while (0) |
---|
32 | |
---|
33 | #endif /* __LIST_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.