-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_dlstclear.c
More file actions
31 lines (27 loc) · 1.15 KB
/
ft_dlstclear.c
File metadata and controls
31 lines (27 loc) · 1.15 KB
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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_dlstclear.c :+: :+: */
/* +:+ */
/* By: jaberkro <jaberkro@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2022/02/25 18:37:48 by jaberkro #+# #+# */
/* Updated: 2022/04/14 12:26:08 by jaberkro ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_dlstclear(t_dlist **dlst)
{
t_dlist *tmp;
if (!dlst || !*dlst)
return ;
while ((*dlst)->previous)
*dlst = (*dlst)->previous;
while (*dlst)
{
tmp = *dlst;
*dlst = (*dlst)->next;
free(tmp);
}
}
/* Removes all links of the doubly linked list. */