aboutsummaryrefslogtreecommitdiff
path: root/test_mini/libft/include/libft_ht.h
diff options
context:
space:
mode:
authornass1pro <nass1pro@gmail.com>2020-06-09 19:48:34 +0200
committerCharles <sircharlesaze@gmail.com>2020-06-13 11:25:24 +0200
commit19d83149feebaeb99430715242aac352890122cc (patch)
treec5b6761db98e27d15bab3fb45ba9e0a646cf06e0 /test_mini/libft/include/libft_ht.h
parent9fabc25a980550afc6337fd729632462f2680daa (diff)
downloadminishell-19d83149feebaeb99430715242aac352890122cc.tar.gz
minishell-19d83149feebaeb99430715242aac352890122cc.tar.bz2
minishell-19d83149feebaeb99430715242aac352890122cc.zip
lexer_test
single_ok
Diffstat (limited to 'test_mini/libft/include/libft_ht.h')
-rw-r--r--test_mini/libft/include/libft_ht.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/test_mini/libft/include/libft_ht.h b/test_mini/libft/include/libft_ht.h
new file mode 100644
index 0000000..10c6fc7
--- /dev/null
+++ b/test_mini/libft/include/libft_ht.h
@@ -0,0 +1,71 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* libft_ht.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/01/31 10:36:09 by cacharle #+# #+# */
+/* 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
+*/
+
+# include "libft.h"
+# include "libft_lst.h"
+
+/*
+** \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_entry;
+
+typedef t_ftlst* t_ftht_bucket;
+
+/*
+** \brief Hash table struct
+** \param size Number of buckets
+** \param buckets Bucket array
+*/
+
+typedef struct s_ftht
+{
+ t_ftsize size;
+ t_ftht_bucket *buckets;
+} t_ftht;
+
+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_entry*));
+void *ft_htget(t_ftht *ht, char *key);
+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_entry*));
+t_ftht_entry *ft_htentry_new(char *key, void *value);
+void ft_htiter(t_ftht *ht, void (*f)(t_ftht_entry*));
+
+/*
+** internals
+*/
+
+int ft_inter_htkey_cmp(const void *ref_key,
+ const void *content);
+
+#endif