42-archive/libftasm/srcs/htb/hashtab_lookup.c
Antoine Riard 03250988f9 hashtab v0
2017-05-16 21:41:09 +02:00

24 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* hashtab_lookup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/05/15 19:38:41 by ariard #+# #+# */
/* Updated: 2017/05/16 21:34:20 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *hashtab_lookup(t_hashtab *htb, void *key,
int (*match)(const void *data_ref, const void *key))
{
int bucket;
if ((bucket = htb->hashfunc(key, htb->capacity)))
return (ft_lst_find(htb->head[bucket], key, match));
return (NULL);
}