forked from samueldotj/dhcp-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist_node.h
51 lines (41 loc) · 1.38 KB
/
list_node.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
49
50
51
/*
* AmigaOS style doubly-linked lists
*
* Manually "upcoded" from the 68000 assembly language
* macros, etc.
*
* Public domain
*
* :ts=4
*/
#ifndef _LIST_NODE_H
#define _LIST_NODE_H
/****************************************************************************/
#include <stdbool.h>
/****************************************************************************/
struct Node
{
struct Node * ln_Succ;
struct Node * ln_Pred;
};
struct List
{
struct Node * lh_Head;
struct Node * lh_Tail;
struct Node * lh_TailPred;
};
/****************************************************************************/
void new_list(struct List *list);
void add_node_to_list_head(struct List *list, struct Node *node);
void add_node_to_list_tail(struct List *list, struct Node *node);
void insert_node(struct List *list __attribute__((unused)), struct Node *list_node, struct Node *node);
void remove_node(struct Node *node);
struct Node *remove_list_head(struct List *list);
struct Node *remove_list_tail(struct List *list);
bool is_list_empty(const struct List *list);
const struct Node *get_list_head(const struct List *list);
const struct Node *get_list_tail(const struct List *list);
const struct Node *get_next_node(const struct Node *node);
const struct Node *get_previous_node(const struct Node *node);
/****************************************************************************/
#endif /* _LIST_NODE_H */