Lines Matching defs:link
57 DBusList *link;
71 link = _dbus_mem_pool_alloc (list_pool);
72 if (link == NULL)
82 link = _dbus_mem_pool_alloc (list_pool);
85 if (link)
86 link->data = data;
90 return link;
94 free_link (DBusList *link)
97 if (_dbus_mem_pool_dealloc (list_pool, link))
109 DBusList *link)
113 link->prev = link;
114 link->next = link;
115 *list = link;
119 link->next = before_this_link;
120 link->prev = before_this_link->prev;
121 before_this_link->prev = link;
122 link->prev->next = link;
125 *list = link;
132 DBusList *link)
136 link->prev = link;
137 link->next = link;
138 *list = link;
142 link->prev = after_this_link;
143 link->next = after_this_link->next;
144 after_this_link->next = link;
145 link->next->prev = link;
181 * Gets the next link in the list, or #NULL if
185 * DBusList *link;
186 * link = _dbus_list_get_first_link (&list);
187 * while (link != NULL)
189 * printf ("value is %p\n", link->data);
190 * link = _dbus_list_get_next_link (&link);
195 * @param link current link.
196 * @returns the next link, or %NULL if none.
203 * Gets the previous link in the list, or #NULL if
207 * DBusList *link;
208 * link = _dbus_list_get_last_link (&list);
209 * while (link != NULL)
211 * printf ("value is %p\n", link->data);
212 * link = _dbus_list_get_prev_link (&link);
217 * @param link current link.
218 * @returns the previous link, or %NULL if none.
227 * @param data the value to store in the link.
228 * @returns a newly allocated link.
240 * @param link the list node
243 _dbus_list_free_link (DBusList *link)
245 free_link (link);
251 * if insufficient memory exists to add a list link.
273 * if insufficient memory exists to add a list link.
284 DBusList *link;
286 link = alloc_link (data);
287 if (link == NULL)
290 link_before (list, *list, link);
296 * Appends a link to the list.
301 * @param link the link to append.
305 DBusList *link)
307 _dbus_list_prepend_link (list, link);
314 * Prepends a link to the list.
319 * @param link the link to prepend.
323 DBusList *link)
325 link_before (list, *list, link);
329 * Inserts data into the list after the given existing link.
332 * @param after_this_link existing link to insert after, or #NULL to prepend
341 DBusList *link;
347 link = alloc_link (data);
348 if (link == NULL)
351 link_after (list, after_this_link, link);
358 * Inserts a link into the list before the given existing link.
361 * @param before_this_link existing link to insert before, or #NULL to append
362 * @param link the link to insert
367 DBusList *link)
370 _dbus_list_append_link (list, link);
372 link_before (list, before_this_link, link);
376 * Inserts a link into the list after the given existing link.
379 * @param after_this_link existing link to insert after, or #NULL to prepend
380 * @param link the link to insert
385 DBusList *link)
388 _dbus_list_prepend_link (list, link);
390 link_after (list, after_this_link, link);
407 DBusList *link;
409 link = *list;
410 while (link != NULL)
412 if (link->data == data)
414 _dbus_list_remove_link (list, link);
418 link = _dbus_list_get_next_link (list, link);
438 DBusList *link;
440 link = _dbus_list_find_last (list, data);
441 if (link)
443 _dbus_list_remove_link (list, link);
451 * Finds a value in the list. Returns the last link
458 * @returns the link if found
464 DBusList *link;
466 link = _dbus_list_get_last_link (list);
468 while (link != NULL)
470 if (link->data == data)
471 return link;
473 link = _dbus_list_get_prev_link (list, link);
480 * Removes the given link from the list, but doesn't
482 * link and also frees it.
485 * @param link the link in the list
489 DBusList *link)
491 if (link->next == link)
498 link->prev->next = link->next;
499 link->next->prev = link->prev;
501 if (*list == link)
502 *list = link->next;
505 link->next = NULL;
506 link->prev = NULL;
510 * Removes a link from the list. This is a constant-time operation.
513 * @param link the list link to remove.
517 DBusList *link)
519 _dbus_list_unlink (list, link);
520 free_link (link);
525 * not free the data in each link, for obvious reasons. This is a
533 DBusList *link;
535 link = *list;
536 while (link != NULL)
538 DBusList *next = _dbus_list_get_next_link (list, link);
540 free_link (link);
542 link = next;
549 * Gets the first link in the list.
553 * @returns the first link, or #NULL for an empty list.
562 * Gets the last link in the list.
566 * @returns the last link, or #NULL for an empty list.
610 * Removes the first link in the list and returns it. This is a
614 * @returns the first link in the list, or #NULL for an empty list.
619 DBusList *link;
621 link = _dbus_list_get_first_link (list);
622 if (link == NULL)
625 _dbus_list_unlink (list, link);
627 return link;
640 DBusList *link;
643 link = _dbus_list_get_first_link (list);
644 if (link == NULL)
647 data = link->data;
648 _dbus_list_remove_link (list, link);
663 DBusList *link;
666 link = _dbus_list_get_last_link (list);
667 if (link == NULL)
670 data = link->data;
671 _dbus_list_remove_link (list, link);
689 DBusList *link;
695 link = *list;
696 while (link != NULL)
698 if (!_dbus_list_append (dest, link->data))
705 link = _dbus_list_get_next_link (list, link);
721 DBusList *link;
726 link = *list;
727 while (link != NULL)
731 link = _dbus_list_get_next_link (list, link);
752 DBusList *link;
754 link = *list;
755 while (link != NULL)
757 DBusList *next = _dbus_list_get_next_link (list, link);
759 (* function) (link->data, data);
761 link = next;
787 DBusList *link;
790 link = *list;
792 if (link == NULL)
795 if (link->next == link)
797 _dbus_assert (link->prev == link);
798 _dbus_assert (*list == link);
806 _dbus_assert (link->prev->next == link);
807 _dbus_assert (link->next->prev == link);
808 link = link->next;
810 while (link != *list);
823 DBusList *link;
828 link = _dbus_list_get_first_link (list);
829 while (link != NULL)
831 int v = _DBUS_POINTER_TO_INT (link->data);
838 link = _dbus_list_get_next_link (list, link);
847 DBusList *link;
852 link = _dbus_list_get_first_link (list);
853 while (link != NULL)
855 int v = _DBUS_POINTER_TO_INT (link->data);
862 link = _dbus_list_get_next_link (list, link);
871 DBusList *link;
873 link = _dbus_list_get_first_link (list);
874 while (link != NULL)
876 int v = _DBUS_POINTER_TO_INT (link->data);
881 link = _dbus_list_get_next_link (list, link);
890 DBusList *link;
892 link = _dbus_list_get_first_link (list);
893 while (link != NULL)
895 int v = _DBUS_POINTER_TO_INT (link->data);
900 link = _dbus_list_get_next_link (list, link);
1096 verify_list (&link2); /* pretend this link is the head */
1108 verify_list (&link1); /* pretend this link is the head */
1120 verify_list (&link1); /* pretend this link is the head */
1204 /* Test remove link more generally */