aboutsummaryrefslogtreecommitdiff
path: root/src/ht/ft_htget.c
blob: 983fd740a637ce534af74bb8eb54f9d148f3d7c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_htget.c                                         :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/01/30 08:33:21 by cacharle          #+#    #+#             */
/*   Updated: 2020/01/30 09:25:51 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "libft.h"

t_ftht_content	*ft_htget(t_ftht *ht, char *key)
{
	t_ftht_digest	digest;

	if (ht == NULL || key == NULL)
		return (NULL);
	digest = ft_hthash(ht, key);
	return (ft_lstbsearch(ht->entries[digest],
				&ft_inter_htkey_equal, key)->content);
}