-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpsw_lstclear.c
31 lines (27 loc) · 1.26 KB
/
psw_lstclear.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* psw_lstclear.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: chris <chris@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/02 16:37:36 by chris #+# #+# */
/* Updated: 2023/02/13 11:31:17 by chris ### ########.fr */
/* */
/* ************************************************************************** */
// This function ft_lstclear deletes and frees the given node and every
// successor of that node, using the function ’del’ and free(3). Finally, the
// pointer to the list must be set to NULL.
// Return: None.
#include "../push_swap.h"
void psw_lstclear(t_psw_list **lst)
{
t_psw_list *tmp;
while (*lst != NULL)
{
tmp = (*lst)->next;
psw_lstdelone(*lst);
*lst = tmp;
}
*lst = NULL;
}