Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/main/ft_free.c
Views: 1269
/* ************************************************************************** */1/* */2/* ::: :::::::: */3/* ft_free.c :+: :+: :+: */4/* +:+ +:+ +:+ */5/* By: ssabbaji <ssabbaji@student.42.fr> +#+ +:+ +#+ */6/* +#+#+#+#+#+ +#+ */7/* Created: 2022/07/27 17:55:52 by yabtaour #+# #+# */8/* Updated: 2022/09/21 17:09:36 by ssabbaji ### ########.fr */9/* */10/* ************************************************************************** */1112#include "minishell.h"1314void ft_free_env(t_env *env)15{16t_env *env_current;17t_env *env_next;1819env_current = env;20while (env_current)21{22env_next = env_current->next;23free(env_current->name);24free(env_current->value);25free(env_current);26env_current = env_next;27}28}2930void ft_free_lexer(t_lexer *lexer)31{32t_lexer *lexer_current;33t_lexer *lexer_next;3435lexer_current = lexer;36while (lexer_current)37{38lexer_next = lexer_current->next;39free(lexer_current->val);40free(lexer_current);41lexer_current = lexer_next;42}43}4445void ft_free_cmd(t_cmd *cmd)46{47t_cmd *cmd_current;48t_cmd *cmd_next;4950cmd_current = cmd;51while (cmd_current)52{53cmd_next = cmd_current->next;54if (cmd_current->cmd)55free_split(cmd_current->cmd);56free(cmd_current);57cmd_current = cmd_next;58}59}606162