1libinn_list(3) InterNetNews Documentation libinn_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
16 struct list {
17 struct node *head;
18 struct node *tail;
19 struct node *tailpred;
20 };
21
22 void list_new(struct list *list);
23
24 struct node *list_addhead(struct list *list, struct node *node);
25
26 struct node *list_addtail(struct list *list, struct node *node);
27
28 struct node *list_head(struct list *list);
29
30 struct node *list_tail(struct list *list);
31
32 struct node *list_succ(struct node *node);
33
34 struct node *list_pred(struct node *node);
35
36 struct node *list_remhead(struct list *list);
37
38 struct node *list_remtail(struct list *list);
39
40 struct node *list_remove(struct node *node);
41
42 struct node *list_insert(struct list *list, struct node *node, struct node *pred);
43
44 bool list_isempty(struct list *list);
45
47 list_new initialises the list header list so as to create an empty
48 list.
49
50 list_addhead adds node to the head of list, returning the node just
51 added.
52
53 list_addtail adds node to the tail of list, returning the node just
54 added.
55
56 list_head returns a pointer to the the node at the head of list or NULL
57 if the list is empty.
58
59 list_tail returns a pointer to the the node at the tail of list or NULL
60 if the list is empty.
61
62 list_succ returns the next (successor) node on the list after node or
63 NULL if node was the final node.
64
65 list_pred returns the previous (predecessor) node on the list before
66 node or NULL if node was the first node.
67
68 list_remhead removes the first node from list and returns it to the
69 caller. If the list is empty NULL is returned.
70
71 list_remtail removes the last node from list and returns it to the
72 caller. If the list is empty NULL is returned.
73
74 list_remove removes node from the list it is on and returns it to the
75 caller.
76
77 list_insert inserts node onto list after the node pred. If pred is NULL
78 then node is added to the head of list.
79
81 Written by Alex Kiernan <alex.kiernan@thus.net> for InterNetNews 2.4.0.
82
83
84
85INN 2.6.5 2022-02-18 libinn_list(3)