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. | |
#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. | |
Functions | |
DBusList * | _dbus_list_alloc_link (void *data) |
Allocates a linked list node. | |
void | _dbus_list_free_link (DBusList *link) |
Frees a linked list node allocated with _dbus_list_alloc_link. | |
dbus_bool_t | _dbus_list_append (DBusList **list, void *data) |
Appends a value to the list. | |
dbus_bool_t | _dbus_list_prepend (DBusList **list, void *data) |
Prepends a value to the list. | |
void | _dbus_list_append_link (DBusList **list, DBusList *link) |
Appends a link to the list. | |
void | _dbus_list_prepend_link (DBusList **list, DBusList *link) |
Prepends a link to the list. | |
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. | |
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. | |
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. | |
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. | |
dbus_bool_t | _dbus_list_remove (DBusList **list, void *data) |
Removes a value from the list. | |
dbus_bool_t | _dbus_list_remove_last (DBusList **list, void *data) |
Removes a value from the list. | |
DBusList * | _dbus_list_find_last (DBusList **list, void *data) |
Finds a value in the list. | |
void | _dbus_list_unlink (DBusList **list, DBusList *link) |
Removes the given link from the list, but doesn't free it. | |
void | _dbus_list_remove_link (DBusList **list, DBusList *link) |
Removes a link from the list. | |
void | _dbus_list_clear (DBusList **list) |
Frees all links in the list and sets the list head to NULL. | |
DBusList * | _dbus_list_get_first_link (DBusList **list) |
Gets the first link in the list. | |
DBusList * | _dbus_list_get_last_link (DBusList **list) |
Gets the last link in the list. | |
void * | _dbus_list_get_last (DBusList **list) |
Gets the last data in the list. | |
void * | _dbus_list_get_first (DBusList **list) |
Gets the first data in the list. | |
DBusList * | _dbus_list_pop_first_link (DBusList **list) |
Removes the first link in the list and returns it. | |
void * | _dbus_list_pop_first (DBusList **list) |
Removes the first value in the list and returns it. | |
void * | _dbus_list_pop_last (DBusList **list) |
Removes the last value in the list and returns it. | |
DBusList * | _dbus_list_pop_last_link (DBusList **list) |
Removes the last link in the list and returns it. | |
dbus_bool_t | _dbus_list_copy (DBusList **list, DBusList **dest) |
Copies a list. | |
int | _dbus_list_get_length (DBusList **list) |
Gets the length of a list. | |
void | _dbus_list_foreach (DBusList **list, DBusForeachFunction function, void *data) |
Calls the given function for each element in the list. | |
dbus_bool_t | _dbus_list_length_is_one (DBusList **list) |
Check whether length is exactly one. |
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. Referenced by _dbus_list_clear(), _dbus_list_copy(), _dbus_list_foreach(), _dbus_list_get_length(), _dbus_list_remove(), _dbus_list_test(), _dbus_object_tree_dispatch_and_unlock(), _dbus_timeout_list_set_functions(), _dbus_watch_list_set_functions(), dbus_address_entry_get_value(), dbus_connection_dispatch(), and dbus_parse_address(). |
|
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. Referenced by _dbus_list_find_last(), _dbus_list_test(), and dbus_connection_remove_filter(). |
|
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. Referenced by _dbus_connection_new_for_transport(), _dbus_connection_queue_received_message(), _dbus_message_add_size_counter(), and dbus_connection_send_with_reply(). |
|
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 _dbus_list_prepend(), FALSE, and TRUE. Referenced by _dbus_list_copy(), _dbus_list_insert_before(), _dbus_list_test(), _dbus_object_tree_dispatch_and_unlock(), _dbus_timeout_list_add_timeout(), _dbus_validate_signature_with_reason(), _dbus_watch_list_add_watch(), dbus_connection_add_filter(), and dbus_parse_address(). |
|
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 _dbus_list_prepend_link(), and next. Referenced by _dbus_connection_queue_received_message_link(), _dbus_list_insert_before_link(), and _dbus_message_add_size_counter_link(). |
|
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 550 of file dbus-list.c. References _dbus_list_get_next_link, and NULL. Referenced by _dbus_auth_unref(), _dbus_list_copy(), _dbus_list_test(), _dbus_message_loader_unref(), _dbus_pending_call_complete_and_unlock(), _dbus_timeout_list_free(), _dbus_validate_signature_with_reason(), _dbus_watch_list_free(), dbus_connection_dispatch(), and dbus_parse_address(). |
|
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 728 of file dbus-list.c. References _dbus_assert, _dbus_list_append(), _dbus_list_clear(), _dbus_list_get_next_link, data, FALSE, NULL, and TRUE. Referenced by _dbus_list_test(), and dbus_connection_dispatch(). |
|
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 480 of file dbus-list.c. References _dbus_list_get_last_link(), _dbus_list_get_prev_link, data, and NULL. Referenced by _dbus_list_remove_last(), _dbus_message_loader_queue_messages(), and _dbus_message_remove_size_counter(). |
|
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 790 of file dbus-list.c. References _dbus_list_get_next_link, data, and NULL. Referenced by _dbus_message_loader_unref(), _dbus_timeout_list_free(), _dbus_timeout_list_set_functions(), _dbus_watch_list_free(), _dbus_watch_list_set_functions(), and dbus_connection_dispatch(). |
|
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. Referenced by _dbus_connection_new_for_transport(), _dbus_list_test(), _dbus_message_remove_size_counter(), dbus_connection_dispatch(), dbus_connection_free_preallocated_send(), and dbus_pending_call_unref(). |
|
Gets the first data in the list. This is a constant-time operation.
Definition at line 620 of file dbus-list.c. References NULL. Referenced by _dbus_list_test(), and dbus_connection_borrow_message(). |
|
Gets the first link in the list. This is a constant-time operation.
Definition at line 575 of file dbus-list.c. Referenced by _dbus_list_pop_first(), _dbus_list_pop_first_link(), _dbus_list_test(), _dbus_object_tree_dispatch_and_unlock(), _dbus_timeout_list_set_functions(), _dbus_watch_list_set_functions(), dbus_address_entry_get_value(), dbus_connection_dispatch(), and dbus_parse_address(). |
|
Gets the last data in the list. This is a constant-time operation.
Definition at line 604 of file dbus-list.c. References NULL. Referenced by _dbus_connection_get_message_to_send(), and _dbus_list_test(). |
|
Gets the last link in the list. This is a constant-time operation.
Definition at line 588 of file dbus-list.c. References NULL. Referenced by _dbus_connection_message_sent(), _dbus_list_find_last(), _dbus_list_pop_last(), _dbus_list_pop_last_link(), _dbus_list_test(), and dbus_connection_remove_filter(). |
|
Gets the length of a list. This is a linear-time operation.
Definition at line 761 of file dbus-list.c. References _dbus_list_get_next_link, and NULL. Referenced by _dbus_list_test(), _dbus_object_tree_dispatch_and_unlock(), and dbus_parse_address(). |
|
Inserts data into the list after the given existing link.
Definition at line 356 of file dbus-list.c. References _dbus_list_prepend(), FALSE, NULL, and TRUE. Referenced by _dbus_list_test(). |
|
Inserts a link into the list after the given existing link.
Definition at line 402 of file dbus-list.c. References _dbus_list_prepend_link(), and NULL. |
|
Inserts data into the list before the given existing link.
Definition at line 326 of file dbus-list.c. References _dbus_list_append(), FALSE, NULL, and TRUE. Referenced by _dbus_list_test(). |
|
Inserts a link into the list before the given existing link.
Definition at line 384 of file dbus-list.c. References _dbus_list_append_link(), and NULL. |
|
Check whether length is exactly one.
Definition at line 814 of file dbus-list.c. References NULL. |
|
Removes the first value in the list and returns it. This is a constant-time operation.
Definition at line 657 of file dbus-list.c. References _dbus_list_get_first_link(), _dbus_list_remove_link(), data, and NULL. Referenced by _dbus_list_test(), _dbus_message_loader_pop_message(), and dbus_connection_steal_borrowed_message(). |
|
Removes the first link in the list and returns it. This is a constant-time operation.
Definition at line 636 of file dbus-list.c. References _dbus_list_get_first_link(), _dbus_list_unlink(), and NULL. Referenced by _dbus_list_test(), and _dbus_message_loader_pop_message_link(). |
|
Removes the last value in the list and returns it. This is a constant-time operation.
Definition at line 680 of file dbus-list.c. References _dbus_list_get_last_link(), _dbus_list_remove_link(), data, and NULL. Referenced by _dbus_list_test(), and _dbus_validate_signature_with_reason(). |
|
Removes the last link in the list and returns it. This is a constant-time operation.
Definition at line 704 of file dbus-list.c. References _dbus_list_get_last_link(), _dbus_list_unlink(), and NULL. Referenced by _dbus_list_test(). |
|
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. References FALSE, NULL, and TRUE. Referenced by _dbus_list_append(), _dbus_list_insert_after(), and _dbus_list_test(). |
|
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. Referenced by _dbus_connection_message_sent(), _dbus_list_append_link(), _dbus_list_insert_after_link(), and _dbus_message_loader_putback_message_link(). |
|
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 423 of file dbus-list.c. References _dbus_list_get_next_link, _dbus_list_remove_link(), data, FALSE, NULL, and TRUE. Referenced by _dbus_list_test(), _dbus_timeout_list_remove_timeout(), and _dbus_watch_list_remove_watch(). |
|
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 454 of file dbus-list.c. References _dbus_list_find_last(), _dbus_list_remove_link(), FALSE, and TRUE. Referenced by _dbus_list_test(), _dbus_timeout_list_add_timeout(), and _dbus_watch_list_add_watch(). |
|
Removes a link from the list. This is a constant-time operation.
Definition at line 535 of file dbus-list.c. References _dbus_list_unlink(). Referenced by _dbus_list_pop_first(), _dbus_list_pop_last(), _dbus_list_remove(), _dbus_list_remove_last(), _dbus_list_test(), _dbus_object_tree_dispatch_and_unlock(), and dbus_connection_remove_filter(). |
|
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 507 of file dbus-list.c. References next, NULL, and prev. Referenced by _dbus_connection_message_sent(), _dbus_list_pop_first_link(), _dbus_list_pop_last_link(), _dbus_list_remove_link(), and _dbus_message_remove_size_counter(). |