-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.h
43 lines (33 loc) · 922 Bytes
/
list.h
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
#ifndef _OLIO_LIST_H_
#define _OLIO_LIST_H_
#include <inttypes.h>
typedef struct _olio_list_entry {
struct _olio_list_entry * next;
struct _olio_list_entry * prev;
void * data;
} olio_list_entry;
typedef struct _olio_list {
struct _olio_list_entry * head;
struct _olio_list_entry * tail;
uint32_t count;
} olio_list;
#ifdef __cplusplus
extern "C" {
#endif
/* basic init/free functions for the list */
void olio_list_init(olio_list *);
void olio_list_free(olio_list *);
/* append an entry to the list */
int olio_list_append(olio_list *, void * data);
void olio_list_head(olio_list *, void ** opaque);
void olio_list_tail(olio_list *, void ** opaque);
void * olio_list_next(olio_list *, void ** opaque);
void * olio_list_prev(olio_list *, void ** opaque);
#ifdef __cplusplus
} /* extern C */
#endif
static inline olio_list_length(const olio_list * l)
{
return l->count;
}
#endif /* _OLIO_LIST_H_ */