Corrected remove elem func for special case where elem is first or last.
This commit is contained in:
parent
152be5f888
commit
6eaea68233
|
|
@ -320,7 +320,9 @@ int linked_list_remove(linked_list_t *linked_list, elem_t *elem)
|
|||
elem_t *next_elem = elem->next;
|
||||
|
||||
if(prev_elem) prev_elem->next = next_elem;
|
||||
else linked_list->first = next_elem;
|
||||
if(next_elem) next_elem->prev = prev_elem;
|
||||
else linked_list->last = prev_elem;
|
||||
|
||||
if(destroy_elem(linked_list, elem)) return_failure_int;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue