-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_list_remove_if.c
28 lines (25 loc) · 1.13 KB
/
ft_list_remove_if.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_remove_if.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ssalaues <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/22 11:49:14 by ssalaues #+# #+# */
/* Updated: 2016/12/22 14:15:39 by ssalaues ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)())
{
t_list *b;
b = *begin_list;
while (b->next != 0)
{
if (!cmp(data_ref, b->data))
free(b->data);
b = b->next;
}
if (!cmp(data_ref, b->data))
free(b->data);
}