fix for halved output data - set list head's prev to new tail

This commit is contained in:
jacekpoz 2024-03-11 01:36:50 +01:00
parent 685d4db676
commit 26f425b811
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -38,6 +38,8 @@ void doubly_linked_list_insert(DoublyLinkedList *l, void *value) {
tail->next = node_new(value, l->element_size); tail->next = node_new(value, l->element_size);
tail->next->next = l->head; tail->next->next = l->head;
tail->next->prev = tail; tail->next->prev = tail;
l->head->prev = tail->next;
l->length += 1; l->length += 1;
} }