lsterase correction oublis verif existence list avant et apres
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: simplonco <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/03/24 15:31:16 by simplonco #+# #+# */
|
||||
/* Updated: 2022/03/24 15:40:32 by simplonco ### ########.fr */
|
||||
/* Updated: 2022/03/24 20:54:20 by simplonco ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -22,8 +22,10 @@ void ft_lsterase(t_list *lst, void (*del)(void *))
|
||||
if (!lst || !del)
|
||||
return ;
|
||||
del(lst->content);
|
||||
lst->prev->next = lst->next;
|
||||
lst->next->prev = lst->prev;
|
||||
if (lst->prev)
|
||||
lst->prev->next = lst->next;
|
||||
if (lst->next)
|
||||
lst->next->prev = lst->prev;
|
||||
free(lst);
|
||||
lst = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user