From 8a4d4c806e9896228f016baa62c5c7e219acf655 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 15 Oct 2019 15:31:06 +0200 Subject: Updated ft_lstiter and ft_lstmap according to the updated subject --- ft_lstmap_bonus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ft_lstmap_bonus.c') diff --git a/ft_lstmap_bonus.c b/ft_lstmap_bonus.c index 9e80a3b..2c97c84 100644 --- a/ft_lstmap_bonus.c +++ b/ft_lstmap_bonus.c @@ -6,14 +6,14 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/09 09:03:57 by cacharle #+# #+# */ -/* Updated: 2019/10/09 12:41:39 by cacharle ### ########.fr */ +/* Updated: 2019/10/15 15:28:47 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include #include "libft.h" -t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *)) +t_list *ft_lstmap(t_list *lst, void *(*f)(void *)) { t_list *mapped; @@ -21,6 +21,7 @@ t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *)) return (NULL); if ((mapped = ft_lstnew(lst->content)) == NULL) return (NULL); + mapped->content = f(mapped->content); mapped->next = ft_lstmap(lst->next, f); return (mapped); } -- cgit