1list(3) InterNetNews Documentation list(3)
2
3
4
6 list - list routines
7
9 #include <inn/list.h>
10
11 struct node {
12 struct node *succ;
13 struct node *pred; };
14
15 struct list {
16 struct node *head;
17 struct node *tail;
18 struct node *tailpred; };
19
20 void list_new(struct list *list);
21
22 struct node *list_addhead(struct list *list, struct node *node);
23
24 struct node *list_addtail(struct list *list, struct node *node);
25
26 struct node *list_head(struct list *list);
27
28 struct node *list_tail(struct list *list);
29
30 struct node *list_succ(struct node *node);
31
32 struct node *list_pred(struct node *node);
33
34 struct node *list_remhead(struct list *list);
35
36 struct node *list_remtail(struct list *list);
37
38 struct node *list_remove(struct node *node);
39
40 struct node *list_insert(struct list *list, struct node *node, struct
41 node *pred);
42
43 bool list_isempty(struct list *list);
44
46 list_new initialises the list header list so as to create an empty
47 list.
48
49 list_addhead adds node to the head of list, returning the node just
50 added.
51
52 list_addtail adds node to the tail of list, returning the node just
53 added.
54
55 list_head returns a pointer to the the node at the head of list or NULL
56 if the list is empty.
57
58 list_tail returns a pointer to the the node at the tail of list or NULL
59 if the list is empty.
60
61 list_succ returns the next (successor) node on the list after node or
62 NULL if node was the final node.
63
64 list_pred returns the previous (predecessor) node on the list before
65 node or NULL if node was the first node.
66
67 list_remhead removes the first node from list and returns it to the
68 caller. If the list is empty NULL is returned.
69
70 list_remtail removes the last node from list and returns it to the
71 caller. If the list is empty NULL is returned.
72
73 list_remove removes node from the list it is on and returns it to the
74 caller.
75
76 list_insert inserts node onto list after the node pred. If pred is NULL
77 then node is added to the head of list.
78
80 Written by Alex Kiernan <alex.kiernan@thus.net> for InterNetNews 2.4.0.
81
82 $Id: list.pod 7851 2008-05-26 19:33:08Z iulius $
83
84
85
86INN 2.5.2 2010-08-11 list(3)