25 #include "dbus-internals.h"    26 #include "dbus-list.h"    27 #include "dbus-mempool.h"    28 #include "dbus-threads-internal.h"    55 alloc_link (
void *data)
    62   if (list_pool == 
NULL)
    66       if (list_pool == 
NULL)
    99         "before we allocated a linked-list link");
   123       link->
next = before_this_link;
   124       link->
prev = before_this_link->
prev;
   125       before_this_link->
prev = link;
   128       if (before_this_link == *list)
   146       link->
prev = after_this_link;
   148       after_this_link->
next = link;
   153 #ifdef DBUS_ENABLE_STATS   167   _dbus_mem_pool_get_stats (list_pool, in_use_p, in_free_list_p, allocated_p);
   244   return alloc_link (data);
   277   *list = (*list)->
next;
   297   link = alloc_link (data);
   301   link_before (list, *list, link);
   321   *list = (*list)->
next;
   336   link_before (list, *list, link);
   354   if (after_this_link == 
NULL)
   358       link = alloc_link (data);
   362       link_after (list, after_this_link, link);
   380   if (before_this_link == 
NULL)
   383     link_before (list, before_this_link, link);
   398   if (after_this_link == 
NULL)
   401     link_after (list, after_this_link, link);
   423       if (link->
data == data)
   481       if (link->
data == data)
   502   if (link->
next == link)
   585     return (*list)->prev;
   601     return (*list)->prev->data;
   617     return (*list)->data;
   770       (* function) (link->
data, data);
   785   return (*list != 
NULL &&
   786           (*list)->next == *list);
   791 #ifdef DBUS_ENABLE_EMBEDDED_TESTS   792 #include "dbus-test.h"   806   if (link->
next == link)
   821   while (link != *list);
   832 is_ascending_sequence (
DBusList **list)
   856 is_descending_sequence (
DBusList **list)
   926   while (link1 && link2)
   947 _dbus_list_test (
void)
   972       verify_list (&list1);
   973       verify_list (&list2);
   986   verify_list (&list1);
   987   verify_list (&list2);
  1022       verify_list (&list1);
  1023       verify_list (&list2);
  1052       void *data1_indirect;
  1063       data1_indirect = got_link1->
data;
  1067       data2 = link2->
data;
  1074       verify_list (&list1);
  1075       verify_list (&list2);
  1097       verify_list (&list1);
  1098       verify_list (&list2);
  1109   while (link2 != 
NULL)
  1111       verify_list (&link2); 
  1121   while (link1 != 
NULL)
  1123       verify_list (&link1); 
  1133   while (link1 != 
NULL)
  1135       verify_list (&link1); 
  1168           verify_list (&list1);
  1169           verify_list (&list2);
  1202           verify_list (&list1);
  1203           verify_list (&list2);
  1212   while (list1 != 
NULL)
  1215       verify_list (&list1);
  1217   while (list2 != 
NULL)
  1220       verify_list (&list2);
  1236   while (link2 != 
NULL)
  1245       verify_list (&list2);
  1256   while (link1 != 
NULL)
  1265       verify_list (&list1);
  1290   verify_list (&list1);
  1291   verify_list (©1);
  1295   verify_list (&list2);
  1296   verify_list (©2);
  1310   verify_list (&list1);
  1311   verify_list (©1);
  1315   verify_list (&list2);
  1316   verify_list (©2);
  1325   verify_list (&list1);
  1330   verify_list (&list1);
  1336   verify_list (&list1);
  1342   verify_list (&list1);
  1357   verify_list (&list1);
 unsigned int dbus_uint32_t
A 32-bit unsigned integer on all platforms. 
void * _dbus_list_get_last(DBusList **list)
Gets the last data in the list. 
dbus_bool_t _dbus_list_prepend(DBusList **list, void *data)
Prepends a value to the list. 
#define NULL
A null pointer, defined appropriately for C or C++. 
void * _dbus_mem_pool_alloc(DBusMemPool *pool)
Allocates an object from the memory pool. 
void * _dbus_list_pop_last(DBusList **list)
Removes the last value in the list and returns it. 
DBusList * next
Next list node. 
#define _DBUS_INT_MIN
Minimum value of type "int". 
dbus_bool_t _dbus_list_length_is_one(DBusList **list)
Check whether length is exactly one. 
DBusList * _dbus_list_get_last_link(DBusList **list)
Gets the last link in the list. 
DBusList * _dbus_list_find_last(DBusList **list, void *data)
Finds a value in the list. 
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_remove_link(DBusList **list, DBusList *link)
Removes a link from the list. 
#define _dbus_assert(condition)
Aborts with an error message if the condition is false. 
#define _DBUS_INT_TO_POINTER(integer)
Safely stuffs an integer into a pointer, to be extracted later with _DBUS_POINTER_TO_INT. 
void _dbus_list_append_link(DBusList **list, DBusList *link)
Appends a link to the list. 
void * data
Data stored at this element. 
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. 
#define _dbus_list_get_prev_link(list, link)
Gets the previous link in the list, or NULL if there are no more links. 
DBusList * _dbus_list_alloc_link(void *data)
Allocates a linked list node. 
dbus_bool_t _dbus_list_remove(DBusList **list, void *data)
Removes a value from the list. 
DBusList * _dbus_list_pop_first_link(DBusList **list)
Removes the first link in the list and returns it. 
dbus_bool_t _dbus_mem_pool_dealloc(DBusMemPool *pool, void *element)
Deallocates an object previously created with _dbus_mem_pool_alloc(). 
DBusList * prev
Previous list node. 
void * _dbus_list_get_first(DBusList **list)
Gets the first data in the list. 
#define _dbus_list_get_next_link(list, link)
Gets the next link in the list, or NULL if there are no more links. 
#define _DBUS_INT_MAX
Maximum value of type "int". 
dbus_bool_t _dbus_list_copy(DBusList **list, DBusList **dest)
Copies a list. 
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_last(DBusList **list, void *data)
Removes a value from the list. 
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE. 
dbus_bool_t _dbus_list_append(DBusList **list, void *data)
Appends a value to the list. 
void _dbus_list_foreach(DBusList **list, DBusForeachFunction function, void *data)
Calls the given function for each element in the list. 
void _dbus_mem_pool_free(DBusMemPool *pool)
Frees a memory pool (and all elements allocated from it). 
#define _DBUS_POINTER_TO_INT(pointer)
Safely casts a void* to an integer; should only be used on void* that actually contain integers...
void * _dbus_list_pop_first(DBusList **list)
Removes the first value in the list and returns it. 
Internals fields of DBusMemPool. 
#define _DBUS_UNLOCK(name)
Unlocks a global lock. 
#define TRUE
Expands to "1". 
#define _dbus_assert_not_reached(explanation)
Aborts with an error message if called. 
void _dbus_list_free_link(DBusList *link)
Frees a linked list node allocated with _dbus_list_alloc_link. 
void _dbus_list_unlink(DBusList **list, DBusList *link)
Removes the given link from the list, but doesn't free it. 
int _dbus_list_get_length(DBusList **list)
Gets the length of a list. 
void(* DBusForeachFunction)(void *element, void *data)
Used to iterate over each item in a collection, such as a DBusList. 
DBusList * _dbus_list_get_first_link(DBusList **list)
Gets the first link in the list. 
#define FALSE
Expands to "0". 
void _dbus_list_prepend_link(DBusList **list, DBusList *link)
Prepends a link to the list. 
#define _DBUS_LOCK(name)
Locks a global lock, initializing it first if necessary. 
DBusMemPool * _dbus_mem_pool_new(int element_size, dbus_bool_t zero_elements)
Creates a new memory pool, or returns NULL on failure. 
void _dbus_list_clear(DBusList **list)
Frees all links in the list and sets the list head to NULL.