From ac0559db82bfef3b7ca3d976b1d7700ed2c1c1fc 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 | 60 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 24 deletions(-) (limited to 'include/libft_ht.h') diff --git a/include/libft_ht.h b/include/libft_ht.h index 8dff87a..8551ddb 100644 --- a/include/libft_ht.h +++ b/include/libft_ht.h @@ -1,44 +1,56 @@ - -#ifndef LIBFT_HT -# define LIBFT_HT +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_ht.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/31 10:36:09 by cacharle #+# #+# */ +/* Updated: 2020/01/31 10:41:24 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LIBFT_HT_H +# define LIBFT_HT_H # include "libft.h" # include "libft_lst.h" -typedef struct +typedef struct s_ftht_content { - char *key; - void *value; -} t_ftht_content; + char *key; + void *value; +} t_ftht_content; typedef t_ftlst* t_ftht_entry; -typedef struct +typedef struct s_ftht { - t_ftsize size; - t_ftht_entry *entries; -} t_ftht; + t_ftsize size; + t_ftht_entry *entries; +} t_ftht; typedef t_ftuint t_ftht_digest; +t_ftht_digest ft_hthash(t_ftht *ht, char *key); -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); -t_ftht_content *ft_htget(t_ftht *ht, char *key); -t_ftht_content *ft_htset(t_ftht *ht, char *key, void *value); -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); +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); +t_ftht_content *ft_htget(t_ftht *ht, char *key); +t_ftht_content *ft_htset(t_ftht *ht, char *key, void *value); +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); /* ** internals */ -void ft_inter_htdelcontent_key(t_ftht_content *content); -t_ftbool ft_inter_htkey_equal(char *ref_key, t_ftht_content *content); +void ft_inter_htdelcontent_key(t_ftht_content *content); +t_ftbool ft_inter_htkey_equal(char *ref_key, + t_ftht_content *content); #endif -- cgit