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 --- include/libft_ht.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/libft_ht.h') diff --git a/include/libft_ht.h b/include/libft_ht.h index 62f2ee1..5a764b6 100644 --- a/include/libft_ht.h +++ b/include/libft_ht.h @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:36:09 by cacharle #+# #+# */ -/* Updated: 2020/02/19 02:38:28 by cacharle ### ########.fr */ +/* Updated: 2020/02/28 12:18:19 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ -- cgit From e792d0a3ff1c1da456c241530571263df0b887b5 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 4 Mar 2020 16:19:05 +0100 Subject: Added ft_htiter.c --- include/libft_ht.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/libft_ht.h') diff --git a/include/libft_ht.h b/include/libft_ht.h index 5a764b6..ea6cb3f 100644 --- a/include/libft_ht.h +++ b/include/libft_ht.h @@ -45,6 +45,7 @@ void ft_htdelone(t_ftht *ht, char *key, void (*del)(t_ftht_content*)); void ft_htdelone_key(t_ftht *ht, char *key); t_ftht_content *ft_htcontent_new(char *key, void *value); +void ft_htiter(t_ftht *ht, void (*f)(t_ftht_content*)); /* ** internals -- 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 --- include/libft_ht.h | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'include/libft_ht.h') diff --git a/include/libft_ht.h b/include/libft_ht.h index ea6cb3f..24abf95 100644 --- a/include/libft_ht.h +++ b/include/libft_ht.h @@ -13,21 +13,38 @@ #ifndef LIBFT_HT_H # define LIBFT_HT_H +/** +** \file libft_ht.h +** \brief Hash table manipulation +*/ + # include "libft.h" # include "libft_lst.h" -typedef struct s_ftht_content +/** +** \brief Hash table entry, key/value pair +** \param key String key +** \param value Pointer to data +*/ + +typedef struct s_ftht_entry { char *key; void *value; -} t_ftht_content; +} t_ftht_entry; + +typedef t_ftlst* t_ftht_bucket; -typedef t_ftlst* t_ftht_entry; +/** +** \brief Hash table struct +** \param size Number of buckets +** \param buckets Bucket array +*/ typedef struct s_ftht { t_ftsize size; - t_ftht_entry *entries; + t_ftht_bucket *buckets; } t_ftht; typedef t_ftuint t_ftht_digest; @@ -35,23 +52,19 @@ typedef t_ftuint t_ftht_digest; t_ftht_digest ft_hthash(t_ftht *ht, char *key); t_ftht *ft_htnew(t_ftsize size); -void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_content*)); -void ft_htdestroy_all(t_ftht *ht); -void ft_htdestroy_key(t_ftht *ht); +void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_entry*)); void *ft_htget(t_ftht *ht, char *key); -t_ftht_content *ft_htset(t_ftht *ht, char *key, void *value, - void (*del)(t_ftht_content*)); +t_ftht_entry *ft_htset(t_ftht *ht, char *key, void *value, + void (*del)(t_ftht_entry*)); void ft_htdelone(t_ftht *ht, char *key, - void (*del)(t_ftht_content*)); -void ft_htdelone_key(t_ftht *ht, char *key); -t_ftht_content *ft_htcontent_new(char *key, void *value); -void ft_htiter(t_ftht *ht, void (*f)(t_ftht_content*)); + void (*del)(t_ftht_entry*)); +t_ftht_entry *ft_htentry_new(char *key, void *value); +void ft_htiter(t_ftht *ht, void (*f)(t_ftht_entry*)); /* ** internals */ -void ft_inter_htdelcontent_key(t_ftht_content *content); int ft_inter_htkey_cmp(const void *ref_key, const void *content); -- 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 --- include/libft_ht.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/libft_ht.h') diff --git a/include/libft_ht.h b/include/libft_ht.h index 24abf95..10c6fc7 100644 --- a/include/libft_ht.h +++ b/include/libft_ht.h @@ -6,14 +6,14 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:36:09 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:18:19 by cacharle ### ########.fr */ +/* Updated: 2020/04/01 17:59:35 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_HT_H # define LIBFT_HT_H -/** +/* ** \file libft_ht.h ** \brief Hash table manipulation */ @@ -21,7 +21,7 @@ # include "libft.h" # include "libft_lst.h" -/** +/* ** \brief Hash table entry, key/value pair ** \param key String key ** \param value Pointer to data @@ -35,7 +35,7 @@ typedef struct s_ftht_entry typedef t_ftlst* t_ftht_bucket; -/** +/* ** \brief Hash table struct ** \param size Number of buckets ** \param buckets Bucket array @@ -59,7 +59,7 @@ t_ftht_entry *ft_htset(t_ftht *ht, char *key, void *value, void ft_htdelone(t_ftht *ht, char *key, void (*del)(t_ftht_entry*)); t_ftht_entry *ft_htentry_new(char *key, void *value); -void ft_htiter(t_ftht *ht, void (*f)(t_ftht_entry*)); +void ft_htiter(t_ftht *ht, void (*f)(t_ftht_entry*)); /* ** internals -- cgit