Advertisement
Guest User

Untitled

a guest
Aug 1st, 2014
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include "../headers/ft_list.h"
  2.  
  3. void    ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)())
  4. {
  5.     t_list *t;
  6.  
  7.     if (*begin_list)
  8.     {
  9.         if ((*cmp)((*begin_list)->data, data_ref) == 0)
  10.         {
  11.             t = (*begin_list);
  12.             (*begin_list) = (*begin_list)->next;
  13.             free(t);
  14.             ft_list_remove_if(begin_list, data_ref, cmp);
  15.         }
  16.         else
  17.             ft_list_remove_if(&((*begin_list)->next), data_ref, cmp);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement