source: libabac/abac_list.h @ 7764378

abac0-leak
Last change on this file since 7764378 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
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);
21int abac_list_remove(abac_list_t *list, void *elt);
22int abac_list_size(abac_list_t *list);
23void 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.