diff options
Diffstat (limited to 'libft/src/bt/ft_btdestroy.c')
| -rw-r--r-- | libft/src/bt/ft_btdestroy.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libft/src/bt/ft_btdestroy.c b/libft/src/bt/ft_btdestroy.c new file mode 100644 index 0000000..c802db0 --- /dev/null +++ b/libft/src/bt/ft_btdestroy.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_btdestroy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/07 21:30:53 by cacharle #+# #+# */ +/* Updated: 2020/02/07 21:35:19 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft_bt.h" + +void ft_btdestroy(t_ftbtree *tree, void (*del)(void *data)) +{ + if (tree == NULL) + return ; + ft_btdestroy(tree->left, del); + ft_btdestroy(tree->right, del); + (*del)(tree->data); + free(tree); +} |
