/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstremove.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: simplonco +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/03/23 22:44:55 by simplonco #+# #+# */ /* Updated: 2022/03/23 22:46:30 by simplonco ### ########.fr */ /* */ /* ************************************************************************** */ /* * remove an element of the list, by moving the content of the next element * and delete and free the next element */ #include "libft.h" void ft_lstremove(t_list *lst, void (*del)(void *)) { t_list *next_tmp; if (!lst || !del) return ; next_tmp = lst->next; del(lst->content); lst->content = lst->next->content; lst->next = lst->next->next; free(next_tmp); }