Home | History | Annotate | Download | only in datastruct

Lines Matching refs:head

22  * The list head's next and previous pointers point back to itself.
24 void dm_list_init(struct dm_list *head)
26 head->n = head->p = head;
30 * Insert an element before 'head'.
31 * If 'head' is the list head, this adds an element to the end of the list.
33 void dm_list_add(struct dm_list *head, struct dm_list *elem)
35 assert(head->n);
37 elem->n = head;
38 elem->p = head->p;
40 head->p->n = elem;
41 head->p = elem;
45 * Insert an element after 'head'.
46 * If 'head' is the list head, this adds an element to the front of the list.
48 void dm_list_add_h(struct dm_list *head, struct dm_list *elem)
50 assert(head->n);
52 elem->n = head->n;
53 elem->p = head;
55 head->n->p = elem;
56 head->n = elem;
71 * Remove an element from existing list and insert before 'head'.
73 void dm_list_move(struct dm_list *head, struct dm_list *elem)
76 dm_list_add(head, elem);
82 int dm_list_empty(const struct dm_list *head)
84 return head->n == head;
90 int dm_list_start(const struct dm_list *head, const struct dm_list *elem)
92 return elem->p == head;
98 int dm_list_end(const struct dm_list *head, const struct dm_list *elem)
100 return elem->n == head;
106 struct dm_list *dm_list_first(const struct dm_list *head)
108 return (dm_list_empty(head) ? NULL : head->n);
114 struct dm_list *dm_list_last(const struct dm_list *head)
116 return (dm_list_empty(head) ? NULL : head->p);
122 struct dm_list *dm_list_prev(const struct dm_list *head, const struct dm_list *elem)
124 return (dm_list_start(head, elem) ? NULL : elem->p);
130 struct dm_list *dm_list_next(const struct dm_list *head, const struct dm_list *elem)
132 return (dm_list_end(head, elem) ? NULL : elem->n);
138 unsigned int dm_list_size(const struct dm_list *head)
143 dm_list_iterate(v, head)