42-archive/libftasm/srcs/lst/ft_lst_find.c
2017-03-31 18:21:20 +02:00

27 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lst_find.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/04 11:09:20 by jhalford #+# #+# */
/* Updated: 2017/01/10 11:07:37 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lst_find(t_list *begin_list, void *data_ref, int (*cmp)())
{
t_list *list_ptr;
list_ptr = begin_list;
while (list_ptr)
{
if ((cmp)(list_ptr->content, data_ref) == 0)
return (list_ptr);
list_ptr = list_ptr->next;
}
return (NULL);
}