rendered paste bodyvoid insert_list (list_ref list, list_item item) {
assert (is_list (list));
if (list->head == NULL && list->last == NULL) {
listnode_ref newhead = malloc (sizeof (struct listnode));
printf("executing empty list code\n");
assert (newhead != NULL);
newhead->prev = NULL;
newhead->next = NULL;
newhead->item = item;
list->head = newhead;
list->head->next = NULL;
list->curr = list->head;
list->last = list->head;
return;
}
else if (list->curr->next == NULL) {
listnode_ref tmp = malloc (sizeof (struct listnode));
assert (tmp != NULL);
printf ("Item:%s");
tmp->item = item;
list->curr->next = tmp;
tmp->prev = list->curr;
list->curr = tmp;
} else {
//no other cases
}
STUBPRINTF ("list=[%p], item=[%p]=%s\n", list, item, item);
}