Lines Matching refs:list
1 /* Generic single linked list to keep various information
52 /* Return the length of a list, list_length(NULL) returns zero */
55 list_length(struct objc_list* list)
58 while(list)
61 list = list->tail;
67 larger than the list length, NULL is returned */
70 list_nth(int indx, struct objc_list* list)
74 if(list->tail)
75 list = list->tail;
79 return list->head;
85 list_remove_head(struct objc_list** list)
87 if ((*list)->tail)
89 struct objc_list* tail = (*list)->tail; /* fetch next */
90 *(*list) = *tail; /* copy next to list head */
93 else /* only one element in list */
95 objc_free(*list);
96 (*list) = 0;
104 list_remove_elem(struct objc_list** list, void* elem)
106 while (*list) {
107 if ((*list)->head == elem)
108 list_remove_head(list);
109 list = &((*list)->tail);
116 list_mapcar(struct objc_list* list, void(*function)(void*))
118 while(list)
120 (*function)(list->head);
121 list = list->tail;
128 list_find(struct objc_list** list, void* elem)
130 while(*list)
132 if ((*list)->head == elem)
133 return list;
134 list = &((*list)->tail);
139 /* Free list (backwards recursive) */
142 list_free(struct objc_list* list)
144 if(list)
146 list_free(list->tail);
147 objc_free(list);