From eb0678367c5cb09b43423f77d6f1c3063fae9a91 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 17 Feb 2020 03:36:53 +0100 Subject: Added ft_lstlsearch and ft_lstlfind for ht manipulation --- src/ht/ft_htdelone.c | 4 ++-- src/ht/ft_htget.c | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src/ht') diff --git a/src/ht/ft_htdelone.c b/src/ht/ft_htdelone.c index e4ab80f..00a0b11 100644 --- a/src/ht/ft_htdelone.c +++ b/src/ht/ft_htdelone.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/30 09:27:18 by cacharle #+# #+# */ -/* Updated: 2020/02/16 02:20:35 by cacharle ### ########.fr */ +/* Updated: 2020/02/17 03:06:58 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,6 +16,6 @@ void ft_htdelone(t_ftht *ht, char *key, void (*del)(t_ftht_content*)) { ft_lstremove_if(ht->entries + ft_hthash(ht, key), - ft_inter_htkey_equal, key, + ft_inter_htkey_cmp, key, (void (*)(void*))del); } diff --git a/src/ht/ft_htget.c b/src/ht/ft_htget.c index 6a9d785..c5e7234 100644 --- a/src/ht/ft_htget.c +++ b/src/ht/ft_htget.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/30 08:33:21 by cacharle #+# #+# */ -/* Updated: 2020/02/16 02:23:23 by cacharle ### ########.fr */ +/* Updated: 2020/02/17 03:06:07 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,11 +18,9 @@ void *ft_htget(t_ftht *ht, char *key) t_ftht_digest digest; - return (NULL); // lstbsearch breaking if (ht == NULL || key == NULL) return (NULL); digest = ft_hthash(ht, key); - return (((t_ftht_content*)ft_lstbsearch(ht->entries[digest], - ft_inter_htkey_equal, - key)->content)->value); + return (((t_ftht_content*)ft_lstlfind(ht->entries[digest], + ft_inter_htkey_cmp, key)->content)->value); } -- cgit