Lines Matching defs:list

14  *    notice, this list of conditions and the following disclaimer.
16 * notice, this list of conditions and the following disclaimer in the
52 Lst_Done(List *list)
56 for (ln = list->first; ln != NULL; ln = next) {
63 Lst_DoneFree(List *list)
67 for (ln = list->first; ln != NULL; ln = next) {
76 Lst_InsertBefore(List *list, ListNode *ln, void *datum)
88 if (ln == list->first)
89 list->first = newNode;
92 /* Add a piece of data at the start of the given list. */
94 Lst_Prepend(List *list, void *datum)
100 ln = LstNodeNew(NULL, list->first, datum);
102 if (list->first == NULL) {
103 list->first = ln;
104 list->last = ln;
106 list->first->prev = ln;
107 list->first = ln;
111 /* Add a piece of data at the end of the given list. */
113 Lst_Append(List *list, void *datum)
119 ln = LstNodeNew(list->last, NULL, datum);
121 if (list->last == NULL) {
122 list->first = ln;
123 list->last = ln;
125 list->last->next = ln;
126 list->last = ln;
131 * Remove the given node from the given list.
135 Lst_Remove(List *list, ListNode *ln)
143 /* unlink it from the list */
144 if (list->first == ln)
145 list->first = ln->next;
146 if (list->last == ln)
147 list->last = ln->prev;
163 * Having NULL values in a list is unusual though.
174 * Time complexity: O(length(list))
177 Lst_FindDatum(List *list, const void *datum)
183 for (ln = list->first; ln != NULL; ln = ln->next)
192 * The source list becomes indeterminate.
232 /* Remove and return the datum at the head of the given list. */
234 Lst_Dequeue(List *list)
236 void *datum = list->first->datum;
237 Lst_Remove(list, list->first);
238 assert(datum != NULL); /* since NULL would mean end of the list */