/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lst_delif.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/04 11:09:12 by jhalford #+# #+# */ /* Updated: 2016/11/16 18:23:24 by jhalford ### ########.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_printf("free'd at %p\n", tmp); (*del)(tmp->content, tmp->content_size); } else indirect = &(*indirect)->next; } }