Home | History | Annotate | Download | only in src

Lines Matching refs:list

33    1. pool of linked list nodes - from static allocated array  
121 For now, dynamically allocate a new list node with the data
123 LListResult Insert(LList *list, void *data)
131 if(list->head == NULL){
132 /* if list is empty, assign to head */
133 list->head = newnode;
134 (list->head)->next = NULL;
135 (list->head)->prev = NULL;
138 list->curr = list->head;
139 list->tail = list->head;
144 if(list->curr == NULL){
145 list->curr = list->tail;
149 if(list->curr == list->tail){
151 newnode->prev = list->curr;
153 (list->curr)->next = newnode;
156 list->curr = newnode;
157 list->tail = newnode;
160 }else if(list->curr == list->head){
162 newnode->next = list->head;
164 (list->head)->prev = newnode;
167 list->curr = list->head;
168 list->head = newnode;
174 newnode->prev = list->curr;
175 newnode->next = (list->curr)->next;
176 (list->curr)->next = newnode;
180 list->curr = newnode;
189 For now, dynamically free a new list node
192 LListResult Delete(LList *list)
196 if(list->head == NULL){
201 if(list->curr == NULL){
202 list->curr = list->tail;
205 curr = list->curr;
207 if(curr == list->head){
209 list->head = curr->next;
211 if(list->head != NULL){
212 (list->head)->prev = NULL;
216 list->curr = list->head;
219 }else if(curr == list->tail){
221 list->tail = curr->prev;
223 if(list->tail != NULL){
224 (list->tail)->next = NULL;
228 list->curr = list->tail;
233 list->curr = curr->next;