aboutsummaryrefslogtreecommitdiff
path: root/src/lst/ft_lstremove_if.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-03-30 22:26:36 +0200
committerCharles <sircharlesaze@gmail.com>2020-03-30 22:26:36 +0200
commit901402c99018422c994bdb297e3ba404969c88ea (patch)
tree98602c73a00af57fb7efcb36e4e3cbae2c0ce3a8 /src/lst/ft_lstremove_if.c
parent40ed37c023627726a5c9c6928284e9f042dc0fa4 (diff)
downloadlibft-901402c99018422c994bdb297e3ba404969c88ea.tar.gz
libft-901402c99018422c994bdb297e3ba404969c88ea.tar.bz2
libft-901402c99018422c994bdb297e3ba404969c88ea.zip
Added documentation for ht and lst
Diffstat (limited to 'src/lst/ft_lstremove_if.c')
-rw-r--r--src/lst/ft_lstremove_if.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lst/ft_lstremove_if.c b/src/lst/ft_lstremove_if.c
index 03643fa..fdac710 100644
--- a/src/lst/ft_lstremove_if.c
+++ b/src/lst/ft_lstremove_if.c
@@ -10,9 +10,15 @@
/* */
/* ************************************************************************** */
-#include "libft.h"
#include "libft_lst.h"
+/**
+** \brief Remove node on some condition
+** \param cmp Comparison function, return 0 if equal
+** \param ref Reference data passed has the first arg of `cmp`
+** \param del Delete function to free removed node data
+*/
+
void ft_lstremove_if(t_ftlst **lst, t_ftcompar_func cmp,
const void *ref, t_ftdel_func del)
{
@@ -20,7 +26,7 @@ void ft_lstremove_if(t_ftlst **lst, t_ftcompar_func cmp,
if (lst == NULL || *lst == NULL)
return ;
- if (cmp(ref, (*lst)->content) == 0)
+ if (cmp(ref, (*lst)->data) == 0)
{
saved_next = (*lst)->next;
ft_lstdelone(*lst, del);