36 lines
1.3 KiB
C
36 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_lst_delif.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/11/04 11:09:12 by jhalford #+# #+# */
|
|
/* Updated: 2017/03/27 17:45:01 by gwojda ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
void ft_lst_delif(
|
|
t_list **alst,
|
|
void *data_ref,
|
|
int (*cmp)(),
|
|
void (*del)(void *, size_t))
|
|
{
|
|
t_list *tmp;
|
|
t_list **indirect;
|
|
|
|
indirect = alst;
|
|
while (*indirect)
|
|
{
|
|
if ((*cmp)((*indirect)->content, data_ref) == 0)
|
|
{
|
|
tmp = (*indirect);
|
|
(*indirect) = (*indirect)->next;
|
|
ft_lstdelone(&tmp, del);
|
|
}
|
|
else
|
|
indirect = &(*indirect)->next;
|
|
}
|
|
}
|