From aa9613efb6fb39bd96fc4836b5d38c3746af1b15 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 30 Jan 2020 10:36:49 +0100 Subject: hash table draft --- src/ht/ft_htdestroy.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/ht/ft_htdestroy.c (limited to 'src/ht/ft_htdestroy.c') diff --git a/src/ht/ft_htdestroy.c b/src/ht/ft_htdestroy.c new file mode 100644 index 0000000..6e04386 --- /dev/null +++ b/src/ht/ft_htdestroy.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_htdestroy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/30 08:19:06 by cacharle #+# #+# */ +/* Updated: 2020/01/30 08:33:09 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_content*)) +{ + if (ht == NULL) + return ; + while (ht->size-- > 0) + ft_lstclear(ht->entries + ht->size, del); + free(ht->entries); + free(ht); +} -- cgit