From c98de126d2252fe47dc2a9094a5f9a8fa6b4b60a Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sun, 11 Oct 2020 15:52:52 +0200 Subject: Removing libft/minishell_test submodules, Removing subject/README/etc --- libft/src/vec/ft_vecdestroy.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 libft/src/vec/ft_vecdestroy.c (limited to 'libft/src/vec/ft_vecdestroy.c') diff --git a/libft/src/vec/ft_vecdestroy.c b/libft/src/vec/ft_vecdestroy.c new file mode 100644 index 0000000..0021573 --- /dev/null +++ b/libft/src/vec/ft_vecdestroy.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_vecdestroy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/01 19:06:22 by charles #+# #+# */ +/* Updated: 2020/08/19 17:49:30 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft_vec.h" + +/* +** \brief Destroy a vector +** \param vec Vector to destroy +** \param del Delete function applied to each element of the vector +** \return NULL +*/ + +void *ft_vecdestroy(t_ftvec *vec, void (*del)(void *elem)) +{ + if (vec == NULL) + return (NULL); + if (del != NULL) + ft_veciter(vec, del); + free(vec->data); + free(vec); + return (NULL); +} -- cgit