change fonctions pour list avec nouvelles fonctions pour listes a deux sens

This commit is contained in:
hugogogo
2022-03-24 16:49:59 +01:00
parent bc53060626
commit 60af4e44b0
27 changed files with 484 additions and 13 deletions

31
srcs/ft_lstremove.delete Normal file
View 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);
}