From 6cb01d2fd8a6b07ef3ddaa8bb322f30c545316e7 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 17 Oct 2019 09:09:41 +0200 Subject: More protection - substr if start > str length - all list functions check for NULL reference - not modifying const pointers --- ft_lstmap_bonus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ft_lstmap_bonus.c') diff --git a/ft_lstmap_bonus.c b/ft_lstmap_bonus.c index 2c97c84..47d72a0 100644 --- a/ft_lstmap_bonus.c +++ b/ft_lstmap_bonus.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/09 09:03:57 by cacharle #+# #+# */ -/* Updated: 2019/10/15 15:28:47 by cacharle ### ########.fr */ +/* Updated: 2019/10/17 09:07:55 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,11 +17,11 @@ t_list *ft_lstmap(t_list *lst, void *(*f)(void *)) { t_list *mapped; - if (lst == NULL) + if (lst == NULL || f == NULL) return (NULL); if ((mapped = ft_lstnew(lst->content)) == NULL) return (NULL); - mapped->content = f(mapped->content); + mapped->content = (*f)(mapped->content); mapped->next = ft_lstmap(lst->next, f); return (mapped); } -- cgit