-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_free_all.c
35 lines (31 loc) · 1.15 KB
/
ft_free_all.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_free_all.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: edjavid <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/25 19:51:37 by edjavid #+# #+# */
/* Updated: 2021/11/25 19:53:14 by edjavid ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_philosopher.h"
void free_elems(t_philo *first)
{
t_philo *tmp;
tmp = first;
while (tmp)
{
first = first->next;
free(tmp);
tmp = first;
}
}
int ft_free_all(t_data *data)
{
if (data->first)
free_elems(data->first);
if (data)
free(data);
return (SUCCESS);
}