lstclear fonctionne plus en recursive
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/11/25 14:13:30 by hulamy #+# #+# */
|
/* Created: 2019/11/25 14:13:30 by hulamy #+# #+# */
|
||||||
/* Updated: 2019/11/25 14:31:30 by hulamy ### ########.fr */
|
/* Updated: 2019/11/28 17:06:48 by hulamy ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -96,7 +96,12 @@
|
|||||||
|
|
||||||
void ft_lstclear(t_list **lst, void (*del)(void *))
|
void ft_lstclear(t_list **lst, void (*del)(void *))
|
||||||
{
|
{
|
||||||
if ((*lst)->next)
|
t_list *next;
|
||||||
ft_lstclear(&(*lst)->next, del);
|
|
||||||
ft_lstdelone(*lst, del);
|
while (*lst != NULL)
|
||||||
|
{
|
||||||
|
next = (*lst)->next;
|
||||||
|
ft_lstdelone(*lst, del);
|
||||||
|
*lst = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,3 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ft_lstclear.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2019/11/25 14:13:30 by hulamy #+# #+# */
|
|
||||||
/* Updated: 2019/11/25 14:31:30 by hulamy ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** delete and free an element of the list and all the followings
|
** delete and free an element of the list and all the followings
|
||||||
*/
|
*/
|
||||||
@@ -96,7 +84,12 @@
|
|||||||
|
|
||||||
void ft_lstclear(t_list **lst, void (*del)(void *))
|
void ft_lstclear(t_list **lst, void (*del)(void *))
|
||||||
{
|
{
|
||||||
if ((*lst)->next)
|
t_list *next;
|
||||||
ft_lstclear(&(*lst)->next, del);
|
|
||||||
ft_lstdelone(*lst, del);
|
while (*lst != NULL)
|
||||||
|
{
|
||||||
|
next = (*lst)->next;
|
||||||
|
ft_lstdelone(*lst, del);
|
||||||
|
*lst = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/11/25 14:14:03 by hulamy #+# #+# */
|
/* Created: 2019/11/25 14:14:03 by hulamy #+# #+# */
|
||||||
/* Updated: 2019/11/25 14:35:53 by hulamy ### ########.fr */
|
/* Updated: 2019/11/28 16:56:40 by hulamy ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user