Lines Matching refs:head

36 // @head: the head of the list
37 // @return: the size of the list given by @head.
38 int ptr_list_size(struct ptr_list *head)
42 if (head) {
43 struct ptr_list *list = head;
46 } while ((list = list->next) != head);
53 // @head: the head of the list
55 bool ptr_list_empty(const struct ptr_list *head)
57 const struct ptr_list *list = head;
59 if (!head)
65 } while ((list = list->next) != head);
72 // @head: the head of the list
74 bool ptr_list_multiple(const struct ptr_list *head)
76 const struct ptr_list *list = head;
79 if (!head)
86 } while ((list = list->next) != head);
93 // @head: the head of the list
95 void *first_ptr_list(struct ptr_list *head)
97 struct ptr_list *list = head;
99 if (!head)
104 if (list == head)
112 // @head: the head of the list
114 void *last_ptr_list(struct ptr_list *head)
118 if (!head)
120 list = head->prev;
122 if (list == head)
131 // @head: the head of the list
135 struct ptr_list *head = list;
137 if (!head)
147 } while ((list = list->next) != head);
154 // @head: the list to be linearized
155 // @arr: a ``void*`` array to fill with @head's entries
165 int linearize_ptr_list(struct ptr_list *head, void **arr, int max)
168 if (head && max > 0) {
169 struct ptr_list *list = head;
181 } while ((list = list->next) != head);
197 struct ptr_list *head = *listp;
199 if (head) {
200 struct ptr_list *entry = head;
216 if (entry == head) {
218 head = next;
224 } while (entry != head);
230 // @head: the ptrlist block to be split
232 // A new block is inserted just after @head and the entries
233 // at the half end of @head are moved to this new block.
234 // The goal being to create space inside @head for a new entry.
235 void split_ptr_list_head(struct ptr_list *head)
237 int old = head->nr, nr = old / 2;
239 struct ptr_list *next = head->next;
242 head->nr = old;
245 newlist->prev = head;
246 head->next = newlist;
248 memcpy(newlist->list, head->list + old, nr * sizeof(void *));
249 memset(head->list + old, 0xf0, nr * sizeof(void *));
311 // @list: the head of the list
314 bool lookup_ptr_list_entry(const struct ptr_list *head, const void *entry)
316 const struct ptr_list *list = head;
318 if (!head)
326 } while ((list = list->next) != head);
377 // @head: a pointer to the list
381 void * undo_ptr_list_last(struct ptr_list **head)
383 struct ptr_list *last, *first = *head;
403 // @head: a pointer to the list
405 void * delete_ptr_list_last(struct ptr_list **head)
408 struct ptr_list *last, *first = *head;
419 *head = NULL;
441 // @src: the head of the source list.
444 struct ptr_list *head, *tail;
450 head = *listp;
451 if (!head) {
456 tail = head->prev;
483 head->prev = tail;
484 tail->next = head;