Lines Matching refs:list

21 /* Encapsulates a double-linked, circular list.
22 * The list is organized in the following way:
24 * list.
25 * - The list is circular, i.e. the "last" list entry references the "list head"
26 * in its 'next' reference, and the "list head" references the "last" entry in
28 * - The list is empty if its 'next' and 'previous' references are addressing the
29 * head of the list.
33 /* Next entry in the list */
35 /* Previous entry in the list */
39 /* Initializes the list. */
41 alist_init(ACList* list)
43 list->next = list->prev = list;
46 /* Checks if the list is empty. */
48 alist_is_empty(const ACList* list)
50 return list->next == list;
53 /* Inserts an entry to the head of the list */
55 alist_insert_head(ACList* list, ACList* entry)
57 ACList* const next = list->next;
59 entry->prev = list;
61 list->next = entry;
63 /* Inserts an entry to the tail of the list */
65 alist_insert_tail(ACList* list, ACList* entry)
67 ACList* const prev = list->prev;
68 entry->next = list;
71 list->prev = entry;
74 /* Removes an entry from the list. NOTE: Entry must be in the list when this
86 /* Returns an entry removed from the head of the list. If the list was empty,
89 alist_remove_head(ACList* list)
92 if (!alist_is_empty(list)) {
93 entry = list->next;
94 list->next = entry->next;
95 entry->next->prev = list;
101 /* Returns an entry removed from the tail of the list. If the list was empty,
104 alist_remove_tail(ACList* list)
107 if (!alist_is_empty(list)) {
108 entry = list->prev;
109 list->prev = entry->prev;
110 entry->prev->next = list;