-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfree.c
44 lines (39 loc) · 1.23 KB
/
free.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
38
39
40
41
42
43
44
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mohkhald <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/01 22:24:12 by mohkhald #+# #+# */
/* Updated: 2025/04/05 01:18:49 by mohkhald ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void ft_free_stack(char **split)
{
int i;
i = 0;
if (!split)
return ;
while (split[i])
{
if (split[i])
free(split[i]);
i++;
}
free(split);
}
void ft_free_list(t_stack **stack)
{
t_stack *tmp;
if (!stack || !(*stack))
return ;
while (*stack)
{
tmp = *stack;
*stack = (*stack)->next;
free(tmp);
}
*stack = NULL;
}