diff --git a/srcd/bonus/ft_lstiter.c b/srcd/bonus/ft_lstiter.c index 52ab6ad..f9b3eee 100644 --- a/srcd/bonus/ft_lstiter.c +++ b/srcd/bonus/ft_lstiter.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:14:11 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:34:59 by hulamy ### ########.fr */ +/* Updated: 2019/11/28 17:20:38 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -75,9 +75,12 @@ void ft_lstiter(t_list *lst, void (*f)(void *)) { - if (!lst) - return ; - if (lst->next) - ft_lstiter(lst->next, f); - f(lst); + if (lst && f) + { + while (lst) + { + f(lst); + lst = lst->next; + } + } } diff --git a/srcs/ft_lstiter.c b/srcs/ft_lstiter.c index 52ab6ad..35427b7 100644 --- a/srcs/ft_lstiter.c +++ b/srcs/ft_lstiter.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:14:11 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:34:59 by hulamy ### ########.fr */ +/* Updated: 2019/11/28 17:19:34 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -75,9 +75,13 @@ void ft_lstiter(t_list *lst, void (*f)(void *)) { - if (!lst) - return ; - if (lst->next) - ft_lstiter(lst->next, f); - f(lst); + + if (lst && f) + { + while (lst) + { + f(lst); + lst = lst->next; + } + { }