Lines Matching refs:list
46 struct curl_llist *list;
48 list = malloc(sizeof(struct curl_llist));
49 if(!list)
52 llist_init(list, dtor);
54 return list;
60 * Inserts a new list element after the given one 'e'. If the given existing
61 * entry is NULL and the list already has elements, the new one will be
62 * inserted first in the list.
69 Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e,
77 if(list->size == 0) {
78 list->head = ne;
79 list->head->prev = NULL;
80 list->head->next = NULL;
81 list->tail = ne;
84 /* if 'e' is NULL here, we insert the new element first in the list */
85 ne->next = e?e->next:list->head;
88 list->head->prev = ne;
89 list->head = ne;
95 list->tail = ne;
101 ++list->size;
110 Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
113 if(e == NULL || list->size == 0)
116 if(e == list->head) {
117 list->head = e->next;
119 if(list->head == NULL)
120 list->tail = NULL;
127 list->tail = e->prev;
132 list->dtor(user, e->ptr);
139 --list->size;
145 Curl_llist_destroy(struct curl_llist *list, void *user)
147 if(list) {
148 while(list->size > 0)
149 Curl_llist_remove(list, list->tail, user);
151 free(list);
156 Curl_llist_count(struct curl_llist *list)
158 return list->size;
164 int Curl_llist_move(struct curl_llist *list, struct curl_llist_element *e,
168 /* Remove element from list */
169 if(e == NULL || list->size == 0)
172 if(e == list->head) {
173 list->head = e->next;
175 if(list->head == NULL)
176 list->tail = NULL;
183 list->tail = e->prev;
188 --list->size;