From 901402c99018422c994bdb297e3ba404969c88ea Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 30 Mar 2020 22:26:36 +0200 Subject: Added documentation for ht and lst --- src/ht/ft_htdestroy.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/ht/ft_htdestroy.c') diff --git a/src/ht/ft_htdestroy.c b/src/ht/ft_htdestroy.c index a788a78..ef4b257 100644 --- a/src/ht/ft_htdestroy.c +++ b/src/ht/ft_htdestroy.c @@ -13,17 +13,18 @@ #include "libft.h" #include "libft_ht.h" -/* -** Destroy an hash table. -** The `del` function is used to destroy each key/value pair +/** +** \brief Destroy an hash table. +** \param del Function to delete each entry +** \warning The del function HAS to free the key */ -void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_content*)) +void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_entry*)) { if (ht == NULL) return ; while (ht->size-- > 0) - ft_lstclear(ht->entries + ht->size, (void (*)(void*))del); - free(ht->entries); + ft_lstdestroy(ht->buckets + ht->size, (void (*)(void*))del); + free(ht->buckets); free(ht); } -- cgit