From 417c7c5da996b2978805e3edf1e53d2656b7279e Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Mon, 9 Jan 2017 16:00:46 +0100 Subject: [PATCH] lst_filter improvement --- libft/src/lst/ft_lst_filter.c | 7 +++++-- libft/src/lst/ft_lstmap.c | 2 +- libft/src/lst/ft_lstsort.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libft/src/lst/ft_lst_filter.c b/libft/src/lst/ft_lst_filter.c index 2df3a067..39b6149f 100644 --- a/libft/src/lst/ft_lst_filter.c +++ b/libft/src/lst/ft_lst_filter.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/04 11:09:17 by jhalford #+# #+# */ -/* Updated: 2016/11/21 12:36:08 by jhalford ### ########.fr */ +/* Updated: 2017/01/09 12:33:31 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,7 +23,10 @@ t_list *ft_lst_filter( out = NULL; while (lst) { - elem = (*f)(lst, data_ref); + if (f) + elem = (*f)(lst, data_ref); + else + elem = lst; elem = ft_lstnew(elem->content, elem->content_size); ft_lsteadd(&out, elem); lst = lst->next; diff --git a/libft/src/lst/ft_lstmap.c b/libft/src/lst/ft_lstmap.c index 1cbd428e..3b6b06c1 100644 --- a/libft/src/lst/ft_lstmap.c +++ b/libft/src/lst/ft_lstmap.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/03 14:57:21 by jhalford #+# #+# */ -/* Updated: 2016/12/12 13:04:00 by jhalford ### ########.fr */ +/* Updated: 2017/01/09 12:30:20 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libft/src/lst/ft_lstsort.c b/libft/src/lst/ft_lstsort.c index 725b532f..950d6fd3 100644 --- a/libft/src/lst/ft_lstsort.c +++ b/libft/src/lst/ft_lstsort.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/04 11:09:58 by jhalford #+# #+# */ -/* Updated: 2016/11/23 15:43:48 by jhalford ### ########.fr */ +/* Updated: 2017/01/09 12:29:58 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */