lst_filter improvement

This commit is contained in:
Jack Halford 2017-01-09 16:00:46 +01:00
parent 034c988135
commit 417c7c5da9
3 changed files with 7 additions and 4 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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;

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */