aboutsummaryrefslogtreecommitdiff
path: root/src/ht/ft_htdestroy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ht/ft_htdestroy.c')
-rw-r--r--src/ht/ft_htdestroy.c23
1 files changed, 23 insertions, 0 deletions
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 <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* 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);
+}