• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/contrib/bmake/

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
51 /* Create and initialize a new, empty list. */
55 List *list = bmake_malloc(sizeof *list);
56 Lst_Init(list);
57 return list;
61 Lst_Done(List *list)
65 for (ln = list->first; ln != NULL; ln = next) {
72 Lst_DoneCall(List *list, LstFreeProc freeProc)
76 for (ln = list->first; ln != NULL; ln = next) {
83 /* Free a list and all its nodes. The node data are not freed though. */
85 Lst_Free(List *list)
88 Lst_Done(list);
89 free(list);
94 Lst_InsertBefore(List *list, ListNode *ln, void *datum)
106 if (ln == list->first)
107 list->first = newNode;
110 /* Add a piece of data at the start of the given list. */
112 Lst_Prepend(List *list, void *datum)
118 ln = LstNodeNew(NULL, list->first, datum);
120 if (list->first == NULL) {
121 list->first = ln;
122 list->last = ln;
124 list->first->prev = ln;
125 list->first = ln;
129 /* Add a piece of data at the end of the given list. */
131 Lst_Append(List *list, void *datum)
137 ln = LstNodeNew(list->last, NULL, datum);
139 if (list->last == NULL) {
140 list->first = ln;
141 list->last = ln;
143 list->last->next = ln;
144 list->last = ln;
149 * Remove the given node from the given list.
153 Lst_Remove(List *list, ListNode *ln)
161 /* unlink it from the list */
162 if (list->first == ln)
163 list->first = ln->next;
164 if (list->last == ln)
165 list->last = ln->prev;
179 * Having NULL values in a list is unusual though.
190 * Time complexity: O(length(list))
193 Lst_FindDatum(List *list, const void *datum)
199 for (ln = list->first; ln != NULL; ln = ln->next)
208 * The source list becomes empty but is not freed.
244 /* Remove and return the datum at the head of the given list. */
246 Lst_Dequeue(List *list)
248 void *datum = list->first->datum;
249 Lst_Remove(list, list->first);
250 assert(datum != NULL); /* since NULL would mean end of the list */