-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.h
48 lines (35 loc) · 930 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
44
45
46
47
48
/*
* Author: Chris Wailes <[email protected]>
* Project: Parallel Linear Program Solver
* Date: 2012/01/24
* Description: A list implementation.
*/
#ifndef LIST_H
#define LIST_H
// Standard Includes
#include <sys/types.h>
// Project Includes
// Types
typedef struct list_node_s {
struct list_node_s* prev;
struct list_node_s* next;
void* data;
} list_node_t;
typedef struct {
list_node_t* head;
list_node_t* tail;
uint size;
} list_t;
// Functions
list_t* list_create(void);
void list_destroy(list_t* list);
void list_free(list_t* list);
void list_init(list_t* list);
list_t* list_new(void);
void list_push(list_t* list, void* data);
void* list_pop(list_t* list);
void list_shift(list_t* list, void* data);
void* list_unshift(list_t* list);
void list_insert_after(list_t* list, list_node_t* node, void* data);
void list_insert_before(list_t* list, list_node_t* node, void* data);
#endif