24 lines
1.1 KiB
C
24 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_list_foreach_if.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/11/09 18:46:56 by gtertysh #+# #+# */
|
|
/* Updated: 2016/11/09 21:22:17 by gtertysh ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "ft_list.h"
|
|
|
|
void ft_list_foreach_if(t_list *begin_list, void (*f)(void *),
|
|
void *data_ref, int (*cmp)())
|
|
{
|
|
while (begin_list)
|
|
{
|
|
if ((cmp(begin_list->data, data_ref) == 0))
|
|
f(begin_list->data);
|
|
begin_list = begin_list->next;
|
|
}
|
|
}
|