diff --git a/lab01/zad3/src/doubly_linked_list.c b/lab01/zad3/src/doubly_linked_list.c index 3db1fb1..cba6614 100644 --- a/lab01/zad3/src/doubly_linked_list.c +++ b/lab01/zad3/src/doubly_linked_list.c @@ -30,14 +30,14 @@ void doubly_linked_list_insert(DoublyLinkedList *l, void *value) { return; } - Node *current = l->head; - while (current->next != l->head) { - current = current->next; + Node *tail = l->head; + while (tail->next != l->head) { + tail = tail->next; } - current->next = node_new(value, l->element_size); - current->next->next = l->head; - current->next->prev = current; + tail->next = node_new(value, l->element_size); + tail->next->next = l->head; + tail->next->prev = tail; l->length += 1; }