72
*----------------------------------------------------------------------
76
* Initialize a member of a doubly linked list
84
*----------------------------------------------------------------------
88
DblLnkLst_Init(DblLnkLst_Links *l) // IN
92
l->prev = l->next = l;
97
*----------------------------------------------------------------------
101
* Merge two doubly linked lists into one
103
* The operation is commutative
104
* The operation is inversible (its inverse is DblLnkLst_Unlink)
112
*----------------------------------------------------------------------
116
DblLnkLst_Link(DblLnkLst_Links *l1, // IN
117
DblLnkLst_Links *l2) // IN
119
DblLnkLst_Links *tmp;
124
(tmp = l1->prev)->next = l2;
125
(l1->prev = l2->prev)->next = l1;
131
*----------------------------------------------------------------------
133
* DblLnkLst_Unlink --
135
* Split one doubly linked list into two
137
* No check is performed: the caller must ensure that both members
138
* belong to the same doubly linked list
140
* The operation is commutative
141
* The operation is inversible (its inverse is DblLnkLst_Link)
149
*----------------------------------------------------------------------
153
DblLnkLst_Unlink(DblLnkLst_Links *l1, // IN
154
DblLnkLst_Links *l2) // IN
156
DblLnkLst_Links *tmp;
162
(l1->prev = l2->prev)->next = l1;
163
(l2->prev = tmp )->next = l2;
168
*----------------------------------------------------------------------
170
* DblLnkLst_Unlink1 --
172
* Unlink an element from its list.
180
*----------------------------------------------------------------------
184
DblLnkLst_Unlink1(DblLnkLst_Links *l) // IN
188
DblLnkLst_Unlink(l, l->next);
193
*----------------------------------------------------------------------------
195
* DblLnkLst_IsLinked --
197
* Determines whether an element is linked with any other elements.
200
* TRUE if link is linked, FALSE otherwise.
205
*----------------------------------------------------------------------------
209
DblLnkLst_IsLinked(DblLnkLst_Links const *l) // IN
213
ASSERT((l->prev == l && l->next == l) ||
214
(l->prev != l && l->next != l));
217
* A DblLnkLst_Links is either linked to itself (not linked) or linked to
218
* other elements in a list (linked).
225
*----------------------------------------------------------------------
227
* DblLnkLst_LinkFirst --
229
* Insert 'l' at the beginning of the list anchored at 'head'
237
*----------------------------------------------------------------------
241
DblLnkLst_LinkFirst(DblLnkLst_Links *head, // IN
242
DblLnkLst_Links *l) // IN
247
DblLnkLst_Link(head->next, l);
252
*----------------------------------------------------------------------
254
* DblLnkLst_LinkLast --
256
* Insert 'l' at the end of the list anchored at 'head'
264
*----------------------------------------------------------------------
268
DblLnkLst_LinkLast(DblLnkLst_Links *head, // IN
269
DblLnkLst_Links *l) // IN
274
DblLnkLst_Link(head, l);
72
* XXX This file is empty because I made all the functions inline.