organised functions into multiple files and did some more norming

This commit is contained in:
mdev9
2024-04-24 11:06:03 +02:00
parent ab5190ee8f
commit 20037a4609
10 changed files with 276 additions and 223 deletions

45
srcs/free.c Normal file
View File

@ -0,0 +1,45 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/24 10:51:13 by marde-vr #+# #+# */
/* Updated: 2024/04/24 10:51:25 by marde-vr ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void free_fds(t_msh *msh)
{
int i;
if (msh->fds)
{
i = 0;
while (msh->fds[i])
{
free(msh->fds[i]);
msh->fds[i] = 0;
i++;
}
free(msh->fds);
msh->fds = 0;
}
}
void free_msh(t_msh *msh)
{
if (msh)
{
free_env(msh->env);
free(msh->pids);
free_cmd(msh->cmds_head);
free_fds(msh);
free(msh->here_doc_filename);
free_token(msh->tokens);
free(msh);
}
}