aboutsummaryrefslogtreecommitdiff
path: root/src/lst/ft_lstremove_if.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-04-01 21:51:51 +0200
committerCharles <sircharlesaze@gmail.com>2020-04-01 21:58:05 +0200
commit65c5d5157e890e9f9445a94fb2d7f660e5492d8e (patch)
tree78613f26bdc531104c3e32d76ffcaf3c2f7013f5 /src/lst/ft_lstremove_if.c
parentc128213daa677d548bfc2905496257fe4a4faf79 (diff)
parenta1675f56b35f5521a91851bae8ca650706374ae6 (diff)
downloadlibft-65c5d5157e890e9f9445a94fb2d7f660e5492d8e.tar.gz
libft-65c5d5157e890e9f9445a94fb2d7f660e5492d8e.tar.bz2
libft-65c5d5157e890e9f9445a94fb2d7f660e5492d8e.zip
Merge branch 'minishell'
Diffstat (limited to 'src/lst/ft_lstremove_if.c')
-rw-r--r--src/lst/ft_lstremove_if.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lst/ft_lstremove_if.c b/src/lst/ft_lstremove_if.c
index 5221ae4..4070355 100644
--- a/src/lst/ft_lstremove_if.c
+++ b/src/lst/ft_lstremove_if.c
@@ -6,13 +6,19 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/30 09:36:49 by cacharle #+# #+# */
-/* Updated: 2020/02/19 02:06:22 by cacharle ### ########.fr */
+/* Updated: 2020/02/28 12:20:51 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
-#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);