Lines Matching refs:list
48 struct curl_llist *list;
50 list = malloc(sizeof(struct curl_llist));
51 if(!list)
54 llist_init(list, dtor);
56 return list;
62 * Inserts a new list element after the given one 'e'. If the given existing
63 * entry is NULL and the list already has elements, the new one will be
64 * inserted first in the list.
71 Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e,
79 if(list->size == 0) {
80 list->head = ne;
81 list->head->prev = NULL;
82 list->head->next = NULL;
83 list->tail = ne;
86 /* if 'e' is NULL here, we insert the new element first in the list */
87 ne->next = e?e->next:list->head;
90 list->head->prev = ne;
91 list->head = ne;
97 list->tail = ne;
103 ++list->size;
112 Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
115 if(e == NULL || list->size == 0)
118 if(e == list->head) {
119 list->head = e->next;
121 if(list->head == NULL)
122 list->tail = NULL;
129 list->tail = e->prev;
134 list->dtor(user, e->ptr);
141 --list->size;
147 Curl_llist_destroy(struct curl_llist *list, void *user)
149 if(list) {
150 while(list->size > 0)
151 Curl_llist_remove(list, list->tail, user);
153 free(list);
158 Curl_llist_count(struct curl_llist *list)
160 return list->size;
166 int Curl_llist_move(struct curl_llist *list, struct curl_llist_element *e,
170 /* Remove element from list */
171 if(e == NULL || list->size == 0)
174 if(e == list->head) {
175 list->head = e->next;
177 if(list->head == NULL)
178 list->tail = NULL;
185 list->tail = e->prev;
190 --list->size;