From 8131a5d26441c5152ab151b4bb49b561e5ca6e81 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 31 Jan 2020 10:44:30 +0100 Subject: hash table unit testing, norming --- src/ht/ft_htdestroy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ht/ft_htdestroy.c') diff --git a/src/ht/ft_htdestroy.c b/src/ht/ft_htdestroy.c index e0442c6..900f76e 100644 --- a/src/ht/ft_htdestroy.c +++ b/src/ht/ft_htdestroy.c @@ -5,8 +5,8 @@ /* +:+ +:+ +:+ */ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/30 08:19:06 by cacharle #+# #+# */ -/* Updated: 2020/01/30 08:33:09 by cacharle ### ########.fr */ +/* Created: 2020/01/30 08:31:02 by cacharle #+# #+# */ +/* Updated: 2020/02/28 12:10:31 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ -- cgit From 2a9133a87109f9430e4827a858ff86596c5f98d5 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 4 Mar 2020 12:49:31 +0100 Subject: Added hash table documentation --- src/ht/ft_htdestroy.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ht/ft_htdestroy.c') diff --git a/src/ht/ft_htdestroy.c b/src/ht/ft_htdestroy.c index 900f76e..a788a78 100644 --- a/src/ht/ft_htdestroy.c +++ b/src/ht/ft_htdestroy.c @@ -13,6 +13,11 @@ #include "libft.h" #include "libft_ht.h" +/* +** Destroy an hash table. +** The `del` function is used to destroy each key/value pair +*/ + void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_content*)) { if (ht == NULL) -- cgit 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 From 9316f2063255bd4a0abd5c38d4c065969a8980bb Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 1 Apr 2020 18:10:36 +0200 Subject: Norm compliant comment format, dirty script for doxygen comments --- src/ht/ft_htdestroy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ht/ft_htdestroy.c') diff --git a/src/ht/ft_htdestroy.c b/src/ht/ft_htdestroy.c index ef4b257..ff362d2 100644 --- a/src/ht/ft_htdestroy.c +++ b/src/ht/ft_htdestroy.c @@ -13,7 +13,7 @@ #include "libft.h" #include "libft_ht.h" -/** +/* ** \brief Destroy an hash table. ** \param del Function to delete each entry ** \warning The del function HAS to free the key -- cgit From d2feec1f97e9f8f201e56ad33662bb663c328a0a Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 3 Apr 2020 07:19:25 +0200 Subject: Changing hash table del function to regular one with a first order internal function, removing a few typedef to instead use standard types --- src/ht/ft_htdestroy.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/ht/ft_htdestroy.c') diff --git a/src/ht/ft_htdestroy.c b/src/ht/ft_htdestroy.c index ff362d2..c43754e 100644 --- a/src/ht/ft_htdestroy.c +++ b/src/ht/ft_htdestroy.c @@ -6,11 +6,10 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/30 08:31:02 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:10:31 by cacharle ### ########.fr */ +/* Updated: 2020/04/03 07:01:30 by charles ### ########.fr */ /* */ /* ************************************************************************** */ -#include "libft.h" #include "libft_ht.h" /* @@ -19,12 +18,15 @@ ** \warning The del function HAS to free the key */ -void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_entry*)) +void ft_htdestroy(t_ftht *ht, t_ftdel_func del) { if (ht == NULL) return ; + ft_inter_htdel_first_order_setup(del); while (ht->size-- > 0) - ft_lstdestroy(ht->buckets + ht->size, (void (*)(void*))del); + ft_lstdestroy(ht->buckets + ht->size, + (void (*)(void*))ft_inter_htdel_first_order); + ft_inter_htdel_first_order_teardown(); free(ht->buckets); free(ht); } -- cgit