data_structures
list_delete.c
Go to the documentation of this file.
1 /* ************************************************************************** */
3 /* */
4 /* ::: :::::::: */
5 /* list_delete.c :+: :+: :+: */
6 /* +:+ +:+ +:+ */
7 /* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8 /* +#+#+#+#+#+ +#+ */
9 /* Created: 2020/07/16 23:14:36 by unite #+# #+# */
10 /* Updated: 2020/07/21 22:33:33 by unite ### ########.fr */
11 /* */
12 /* ************************************************************************** */
13 
14 #include "list.h"
15 
16 void list_delete(t_list *alst)
17 {
18  if (alst == NULL)
19  return ;
20  while (alst->size)
21  list_remove_first(alst);
22  free(alst);
23 }
list_delete
void list_delete(t_list *alst)
Deletes the list and frees all memory taken by its contents.
Definition: list_delete.c:16
s_list
Doubly-linked list of generic items.
Definition: list.h:54
s_list::size
size_t size
The number of items in the list.
Definition: list.h:58
list_remove_first
void list_remove_first(t_list *alst)
Removes the first item in the list.
Definition: list_remove_first.c:16
list.h