Lines Matching refs:list

17 /* Encapsulates a double-linked, circular list.
18 * The list is organized in the following way:
20 * list.
21 * - The list is circular, i.e. the "last" list entry references the "list head"
22 * in its 'next' reference, and the "list head" references the "last" entry in
24 * - The list is empty if its 'next' and 'previous' references are addressing the
25 * head of the list.
29 /* Next entry in the list */
31 /* Previous entry in the list */
35 /* Initializes the list. */
37 alist_init(ACList* list)
39 list->next = list->prev = list;
42 /* Checks if the list is empty. */
44 alist_is_empty(const ACList* list)
46 return list->next == list;
49 /* Inserts an entry to the head of the list */
51 alist_insert_head(ACList* list, ACList* entry)
53 ACList* const next = list->next;
55 entry->prev = list;
57 list->next = entry;
59 /* Inserts an entry to the tail of the list */
61 alist_insert_tail(ACList* list, ACList* entry)
63 ACList* const prev = list->prev;
64 entry->next = list;
67 list->prev = entry;
70 /* Removes an entry from the list. NOTE: Entry must be in the list when this
82 /* Returns an entry removed from the head of the list. If the list was empty,
85 alist_remove_head(ACList* list)
88 if (!alist_is_empty(list)) {
89 entry = list->next;
90 list->next = entry->next;
91 entry->next->prev = list;
97 /* Returns an entry removed from the tail of the list. If the list was empty,
100 alist_remove_tail(ACList* list)
103 if (!alist_is_empty(list)) {
104 entry = list->prev;
105 list->prev = entry->prev;
106 entry->prev->next = list;