minishell/src/environment/environment_free_list.c
2025-02-25 15:43:56 +01:00

34 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* :::::::: */
/* environment_free_list.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/04 16:13:59 by whaffman #+# #+# */
/* Updated: 2025/02/25 15:24:08 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
#include "minishell.h"
void environment_free_list(t_minishell *minishell)
{
t_list **lst;
t_list *next;
lst = &minishell->environment;
if (!lst)
return ;
while (*lst)
{
if ((*lst)->next)
next = (*lst)->next;
else
next = NULL;
environment_free(minishell, (*lst)->content);
free(*lst);
*lst = next;
}
}