-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_htdel.c
37 lines (34 loc) · 1.31 KB
/
ft_htdel.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_htdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thakala <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/26 16:20:22 by thakala #+# #+# */
/* Updated: 2021/12/27 13:26:35 by thakala ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_htdel(t_ht *ht, ssize_t seed, void (*del)(void *c, size_t s))
{
t_list *previous;
t_list *iterator;
t_list *next;
previous = ht->t[ft_hthash(ht, seed)];
if (!previous)
return ;
iterator = previous;
while (iterator)
{
next = iterator->next;
if (iterator->content_size == seed)
{
previous->next = next;
return (ft_lstdelone(iterator, del));
}
previous = iterator;
iterator = next;
}
return ;
}