Lines Matching refs:list

8 // Pointer list manipulation
13 // * NULL is used by {PREPARE,NEXT}_PTR_LIST() to indicate the end-of-list.
17 // (OP_PHI) use a list to store their operands, a VOID in a phi-node
18 // list must be ignored since it represents a removed operand. As
32 __ALLOCATOR(struct ptr_list, "ptr list", ptrlist);
36 // @head: the head of the list
37 // @return: the size of the list given by @head.
43 struct ptr_list *list = head;
45 nr += list->nr - list->rm;
46 } while ((list = list->next) != head);
52 // test if a list is empty
53 // @head: the head of the list
54 // @return: ``true`` if the list is empty, ``false`` otherwise.
57 const struct ptr_list *list = head;
63 if (list->nr - list->rm)
65 } while ((list = list->next) != head);
71 // test is a list contains more than one element
72 // @head: the head of the list
73 // @return: ``true`` if the list has more than 1 element, ``false`` otherwise.
76 const struct ptr_list *list = head;
83 nr += list->nr - list->rm;
86 } while ((list = list->next) != head);
93 // @head: the head of the list
94 // @return: the first element of the list or ``NULL`` if the list is empty
97 struct ptr_list *list = head;
102 while (list->nr == 0) {
103 list = list->next;
104 if (list == head)
107 return PTR_ENTRY_NOTAG(list, 0);
112 // @head: the head of the list
113 // @return: the last element of the list or ``NULL`` if the list is empty
116 struct ptr_list *list;
120 list = head->prev;
121 while (list->nr == 0) {
122 if (list == head)
124 list = list->prev;
126 return PTR_ENTRY_NOTAG(list, list->nr-1);
131 // @head: the head of the list
132 // @return: the nth element of the list or ``NULL`` if the list is too short.
133 void *ptr_list_nth_entry(struct ptr_list *list, unsigned int idx)
135 struct ptr_list *head = list;
141 unsigned int nr = list->nr;
144 return list->list[idx];
147 } while ((list = list->next) != head);
152 // linearize the entries of a list
154 // @head: the list to be linearized
157 // @return: the number of entries in the list.
159 // Linearize the entries of a list up to a total of @max,
160 // and return the number of entries in the list.
169 struct ptr_list *list = head;
172 int i = list->nr;
178 memcpy(arr, list->list, i*sizeof(void *));
181 } while ((list = list->next) != head);
189 // @listp: a pointer to the list to be packed.
191 // When we've walked the list and deleted entries,
248 memcpy(newlist->list, head->list + old, nr * sizeof(void *));
249 memset(head->list + old, 0xf0, nr * sizeof(void *));
254 // @listp: a pointer to the list
255 // @ptr: the entry to add to the list
262 struct ptr_list *list = *listp;
267 if (!list || (nr = (last = list->prev)->nr) >= LIST_NODE_NR) {
269 if (!list) {
275 newlist->next = list;
276 list->prev = newlist;
282 ret = last->list + nr;
291 // @listp: a pointer to the list
292 // @ptr: the entry to add to the list
311 // @list: the head of the list
316 const struct ptr_list *list = head;
321 int nr = list->nr;
324 if (list->list[i] == entry)
326 } while ((list = list->next) != head);
332 // @list: a pointer to the list
335 int delete_ptr_list_entry(struct ptr_list **list, void *entry, int count)
339 FOR_EACH_PTR(*list, ptr) {
348 pack_ptr_list(list);
354 // @list: a pointer to the list
358 int replace_ptr_list_entry(struct ptr_list **list, void *old_ptr,
363 FOR_EACH_PTR(*list, ptr) {
377 // @head: a pointer to the list
378 // @return: the last element of the list or NULL if the list is empty.
380 // :note: this doesn't repack the list
393 ptr = last->list[nr];
394 last->list[nr] = (void *)0xf1f1f1f1;
402 // remove the last entry and repack the list
403 // @head: a pointer to the list
404 // @return: the last element of the list or NULL if the list is empty.
414 ptr = last->list[--last->nr];
427 // @a: the source list
428 // @b: a pointer to the destination list.
439 // copy the elements of a list at the end of another list.
440 // @listp: a pointer to the destination list.
441 // @src: the head of the source list.
463 void *ptr = cur->list[i++];
474 tail->list[idx++] = ptr;
489 // @listp: a pointer to the list
490 // Each blocks of the list are freed (but the entries
497 struct ptr_list *tmp, *list = *listp;
499 if (!list)
502 list->prev->next = NULL;
503 while (list) {
504 tmp = list;
505 list = list->next;