change fonctions pour list avec nouvelles fonctions pour listes a deux sens
This commit is contained in:
30
srcs/ft_lsterase.c
Normal file
30
srcs/ft_lsterase.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_lsterase.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: simplonco <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/03/24 15:31:16 by simplonco #+# #+# */
|
||||
/* Updated: 2022/03/24 15:40:32 by simplonco ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/*
|
||||
* erase an element in two-way list
|
||||
* and rejoin the list
|
||||
*/
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
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;
|
||||
free(lst);
|
||||
lst = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user