Data Structures | |
struct | DBusList |
A node in a linked list. More... | |
Defines | |
#define | _dbus_list_get_next_link(list, link) ((link)->next == *(list) ? NULL : (link)->next) |
Gets the next link in the list, or NULL if there are no more links. More... | |
#define | _dbus_list_get_prev_link(list, link) ((link) == *(list) ? NULL : (link)->prev) |
Gets the previous link in the list, or NULL if there are no more links. More... | |
Functions | |
DBusList * | _dbus_list_alloc_link (void *data) |
Allocates a linked list node. More... | |
void | _dbus_list_free_link (DBusList *link) |
Frees a linked list node allocated with _dbus_list_alloc_link. More... | |
dbus_bool_t | _dbus_list_append (DBusList **list, void *data) |
Appends a value to the list. More... | |
dbus_bool_t | _dbus_list_prepend (DBusList **list, void *data) |
Prepends a value to the list. More... | |
void | _dbus_list_append_link (DBusList **list, DBusList *link) |
Appends a link to the list. More... | |
void | _dbus_list_prepend_link (DBusList **list, DBusList *link) |
Prepends a link to the list. More... | |
dbus_bool_t | _dbus_list_insert_before (DBusList **list, DBusList *before_this_link, void *data) |
Inserts data into the list before the given existing link. More... | |
dbus_bool_t | _dbus_list_insert_after (DBusList **list, DBusList *after_this_link, void *data) |
Inserts data into the list after the given existing link. More... | |
void | _dbus_list_insert_before_link (DBusList **list, DBusList *before_this_link, DBusList *link) |
Inserts a link into the list before the given existing link. More... | |
void | _dbus_list_insert_after_link (DBusList **list, DBusList *after_this_link, DBusList *link) |
Inserts a link into the list after the given existing link. More... | |
dbus_bool_t | _dbus_list_remove (DBusList **list, void *data) |
Removes a value from the list. More... | |
dbus_bool_t | _dbus_list_remove_last (DBusList **list, void *data) |
Removes a value from the list. More... | |
DBusList * | _dbus_list_find_last (DBusList **list, void *data) |
Finds a value in the list. More... | |
void | _dbus_list_unlink (DBusList **list, DBusList *link) |
Removes the given link from the list, but doesn't free it. More... | |
void | _dbus_list_remove_link (DBusList **list, DBusList *link) |
Removes a link from the list. More... | |
void | _dbus_list_clear (DBusList **list) |
Frees all links in the list and sets the list head to NULL. More... | |
DBusList * | _dbus_list_get_first_link (DBusList **list) |
Gets the first link in the list. More... | |
DBusList * | _dbus_list_get_last_link (DBusList **list) |
Gets the last link in the list. More... | |
void * | _dbus_list_get_last (DBusList **list) |
Gets the last data in the list. More... | |
void * | _dbus_list_get_first (DBusList **list) |
Gets the first data in the list. More... | |
DBusList * | _dbus_list_pop_first_link (DBusList **list) |
Removes the first link in the list and returns it. More... | |
void * | _dbus_list_pop_first (DBusList **list) |
Removes the first value in the list and returns it. More... | |
void * | _dbus_list_pop_last (DBusList **list) |
Removes the last value in the list and returns it. More... | |
DBusList * | _dbus_list_pop_last_link (DBusList **list) |
Removes the last link in the list and returns it. More... | |
dbus_bool_t | _dbus_list_copy (DBusList **list, DBusList **dest) |
Copies a list. More... | |
int | _dbus_list_get_length (DBusList **list) |
Gets the length of a list. More... | |
void | _dbus_list_foreach (DBusList **list, DBusForeachFunction function, void *data) |
Calls the given function for each element in the list. More... | |
dbus_bool_t | _dbus_list_length_is_one (DBusList **list) |
Check whether length is exactly one. More... |
Types and functions related to DBusList.
|
Gets the next link in the list, or NULL if there are no more links. Used for iteration.
DBusList *link; link = _dbus_list_get_first_link (&list); while (link != NULL) { printf ("value is %p\n", link->data); link = _dbus_list_get_next_link (&link); }
Definition at line 94 of file dbus-list.h. |
|
Gets the previous link in the list, or NULL if there are no more links. Used for iteration.
DBusList *link; link = _dbus_list_get_last_link (&list); while (link != NULL) { printf ("value is %p\n", link->data); link = _dbus_list_get_prev_link (&link); }
Definition at line 95 of file dbus-list.h. |
|
Allocates a linked list node. Useful for preallocating nodes and using _dbus_list_append_link() to avoid allocations.
Definition at line 219 of file dbus-list.c. |
|
Appends a value to the list. May return FALSE if insufficient memory exists to add a list link. This is a constant-time operation.
Definition at line 247 of file dbus-list.c. References next. |
|
Appends a link to the list. Cannot fail due to out of memory. This is a constant-time operation.
Definition at line 292 of file dbus-list.c. References next. |
|
Frees all links in the list and sets the list head to NULL. Does not free the data in each link, for obvious reasons. This is a linear-time operation.
Definition at line 548 of file dbus-list.c. |
|
Copies a list. This is a linear-time operation. If there isn't enough memory to copy the entire list, the destination list will be set to NULL.
Definition at line 724 of file dbus-list.c. References data. |
|
Finds a value in the list. Returns the last link with value equal to the given data pointer. This is a linear-time operation. Returns NULL if no value found that matches.
Definition at line 478 of file dbus-list.c. References data. |
|
Calls the given function for each element in the list. The function is passed the list element as its first argument, and the given data as its second argument.
Definition at line 786 of file dbus-list.c. References data. |
|
Frees a linked list node allocated with _dbus_list_alloc_link. Does not free the data in the node.
Definition at line 231 of file dbus-list.c. |
|
Gets the first data in the list. This is a constant-time operation.
Definition at line 618 of file dbus-list.c. |
|
Gets the first link in the list. This is a constant-time operation.
Definition at line 573 of file dbus-list.c. |
|
Gets the last data in the list. This is a constant-time operation.
Definition at line 602 of file dbus-list.c. |
|
Gets the last link in the list. This is a constant-time operation.
Definition at line 586 of file dbus-list.c. |
|
Gets the length of a list. This is a linear-time operation.
Definition at line 757 of file dbus-list.c. |
|
Inserts data into the list after the given existing link.
Definition at line 354 of file dbus-list.c. |
|
Inserts a link into the list after the given existing link.
Definition at line 400 of file dbus-list.c. |
|
Inserts data into the list before the given existing link.
Definition at line 325 of file dbus-list.c. |
|
Inserts a link into the list before the given existing link.
Definition at line 382 of file dbus-list.c. |
|
Check whether length is exactly one.
Definition at line 810 of file dbus-list.c. |
|
Removes the first value in the list and returns it. This is a constant-time operation.
Definition at line 655 of file dbus-list.c. References data. |
|
Removes the first link in the list and returns it. This is a constant-time operation.
Definition at line 634 of file dbus-list.c. |
|
Removes the last value in the list and returns it. This is a constant-time operation.
Definition at line 678 of file dbus-list.c. References data. |
|
Removes the last link in the list and returns it. This is a constant-time operation.
Definition at line 701 of file dbus-list.c. |
|
Prepends a value to the list. May return FALSE if insufficient memory exists to add a list link. This is a constant-time operation.
Definition at line 269 of file dbus-list.c. |
|
Prepends a link to the list. Cannot fail due to out of memory. This is a constant-time operation.
Definition at line 310 of file dbus-list.c. |
|
Removes a value from the list. Only removes the first value equal to the given data pointer, even if multiple values exist which match. This is a linear-time operation.
Definition at line 421 of file dbus-list.c. References data. |
|
Removes a value from the list. Only removes the last value equal to the given data pointer, even if multiple values exist which match. This is a linear-time operation.
Definition at line 452 of file dbus-list.c. |
|
Removes a link from the list. This is a constant-time operation.
Definition at line 533 of file dbus-list.c. |
|
Removes the given link from the list, but doesn't free it. _dbus_list_remove_link() both removes the link and also frees it.
Definition at line 505 of file dbus-list.c. |