change fonctions pour list avec nouvelles fonctions pour listes a deux sens
This commit is contained in:
31
srcs/ft_lstremove.delete
Normal file
31
srcs/ft_lstremove.delete
Normal file
@@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_lstremove.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: simplonco <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
}
|
||||
Reference in New Issue
Block a user