1libinn_list(3)            InterNetNews Documentation            libinn_list(3)
2
3
4

NAME

6       list - list routines
7

SYNOPSIS

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,
43                                    struct node *pred);
44
45           bool list_isempty(struct list *list);
46

DESCRIPTION

48       list_new initialises the list header list so as to create an empty
49       list.
50
51       list_addhead adds node to the head of list, returning the node just
52       added.
53
54       list_addtail adds node to the tail of list, returning the node just
55       added.
56
57       list_head returns a pointer to the node at the head of list or NULL if
58       the list is empty.
59
60       list_tail returns a pointer to the node at the tail of list or NULL if
61       the list is empty.
62
63       list_succ returns the next (successor) node on the list after node or
64       NULL if node was the final node.
65
66       list_pred returns the previous (predecessor) node on the list before
67       node or NULL if node was the first node.
68
69       list_remhead removes the first node from list and returns it to the
70       caller.  If the list is empty NULL is returned.
71
72       list_remtail removes the last node from list and returns it to the
73       caller.  If the list is empty NULL is returned.
74
75       list_remove removes node from the list it is on and returns it to the
76       caller.
77
78       list_insert inserts node onto list after the node pred.  If pred is
79       NULL then node is added to the head of list.
80

HISTORY

82       Written by Alex Kiernan <alex.kiernan@thus.net> for InterNetNews 2.4.0.
83
84
85
86INN 2.7.1                         2023-03-07                    libinn_list(3)
Impressum