aboutsummaryrefslogtreecommitdiff
path: root/src/ht/ft_htnew.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-04-01 21:51:51 +0200
committerCharles <sircharlesaze@gmail.com>2020-04-01 21:58:05 +0200
commit65c5d5157e890e9f9445a94fb2d7f660e5492d8e (patch)
tree78613f26bdc531104c3e32d76ffcaf3c2f7013f5 /src/ht/ft_htnew.c
parentc128213daa677d548bfc2905496257fe4a4faf79 (diff)
parenta1675f56b35f5521a91851bae8ca650706374ae6 (diff)
downloadlibft-65c5d5157e890e9f9445a94fb2d7f660e5492d8e.tar.gz
libft-65c5d5157e890e9f9445a94fb2d7f660e5492d8e.tar.bz2
libft-65c5d5157e890e9f9445a94fb2d7f660e5492d8e.zip
Merge branch 'minishell'
Diffstat (limited to 'src/ht/ft_htnew.c')
-rw-r--r--src/ht/ft_htnew.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ht/ft_htnew.c b/src/ht/ft_htnew.c
index d98a724..e5335d2 100644
--- a/src/ht/ft_htnew.c
+++ b/src/ht/ft_htnew.c
@@ -6,13 +6,19 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/30 08:19:16 by cacharle #+# #+# */
-/* Updated: 2020/02/10 02:16:20 by cacharle ### ########.fr */
+/* Updated: 2020/02/28 12:23:43 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "libft_ht.h"
+/*
+** \brief Create a new hash table.
+** \param size Size of the underlying array of linked list (buckets)
+** \return Created hash table or NULL is an allocation failed
+*/
+
t_ftht *ft_htnew(t_ftsize size)
{
t_ftht *ht;
@@ -21,8 +27,8 @@ t_ftht *ft_htnew(t_ftsize size)
return (NULL);
if ((ht = (t_ftht*)malloc(sizeof(t_ftht))) == NULL)
return (NULL);
- ht->entries = (t_ftht_entry*)ft_calloc(size, sizeof(t_ftht_entry));
- if (ht->entries == NULL)
+ ht->buckets = (t_ftht_bucket*)ft_calloc(size, sizeof(t_ftht_entry));
+ if (ht->buckets == NULL)
{
free(ht);
return (NULL);