source: libabac/abac_list.h @ 202a7f9

mei_rt2mei_rt2_fix_1meiyap-rt1rt2
Last change on this file since 202a7f9 was 202a7f9, checked in by Mei <mei@…>, 12 years ago

commited modified files for rt1

  • Property mode set to 100644
File size: 929 bytes
Line 
1#ifndef __LIST_H__
2#define __LIST_H__
3
4#include "utlist.h"
5
6typedef struct _abac_list_t abac_list_t;
7typedef struct _abac_list_element_t abac_list_element_t;
8
9struct _abac_list_element_t {
10    void *ptr;
11    abac_list_element_t *prev, *next;
12};
13
14struct _abac_list_t {
15    abac_list_element_t *elts;
16    int size;
17};
18
19abac_list_t *abac_list_new(void);
20void abac_list_add(abac_list_t *list, void *elt);
21void abac_list_prepend(abac_list_t *list, void *elt);
22int abac_list_remove(abac_list_t *list, void *elt);
23int abac_list_size(abac_list_t *list);
24void abac_list_free(abac_list_t *list);
25
26#define abac_list_foreach(LIST, CURRENT, BODY) do {  \
27    abac_list_element_t *_elt;                  \
28    DL_FOREACH(LIST->elts, _elt) {              \
29        CURRENT = (typeof(CURRENT))_elt->ptr;   \
30        BODY                                    \
31    }                                           \
32} while (0)
33
34#endif /* __LIST_H__ */
Note: See TracBrowser for help on using the repository browser.