-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.h
30 lines (23 loc) · 899 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
#ifndef _LIST_H
#define _LIST_H
typedef struct list_node {
void *data;
unsigned long size;
struct list_node *next;
} list_node_t;
typedef struct {
list_node_t *head;
list_node_t *tail;
} list_t;
int list_init(list_t*const list);
int list_insert_tail(list_t*const list, const void*const buf, unsigned long size);
int list_insert_head(list_t*const list, const void*const buf, unsigned long size);
int list_remove_head(list_t*const list);
int list_remove_tail(list_t*const list);
unsigned long list_peek(const list_node_t*const lnode, void*const buf);
unsigned long list_get_count(list_t*const list);
void list_deinit(list_t*const list);
int list_empty(const list_t*const list);
static list_node_t* listnode_init(const void*const buf, unsigned long size);
static void listnode_deinit(list_node_t*const lnode);
#endif