minishell
Minishell Project for École 42
|
Functions for freeing allocated memory in the minishell. More...
#include "minishell.h"
Functions | |
char ** | free_str_arr (char **arr) |
Frees the allocated memory of a string array. | |
void | free_environ (t_environ_list *environ) |
Frees the memory used by the environment list and its nodes. | |
t_lexer_list * | free_lex (t_lexer_list *lex_head) |
Frees the allocated memory of a linked list of lexer elements. | |
t_executor * | free_executor_list (t_executor *list) |
Frees the allocated memory of a linked list of t_executor elements. | |
void | free_heap (t_shell *shell) |
Frees the memory used by the main data structure (shell environment). | |
Functions for freeing allocated memory in the minishell.
void free_environ | ( | t_environ_list * | environ | ) |
Frees the memory used by the environment list and its nodes.
Releases the memory allocated for the environment list and its associated nodes, freeing the memory used by keys and values as well.
[in,out] | environ | A pointer the the environment list to be freed. |
t_executor * free_executor_list | ( | t_executor * | list | ) |
Frees the allocated memory of a linked list of t_executor elements.
Frees the memory of each node in the linked list, also frees the allocated members path and execs of each node. The entire linked list is freed. Its pointer is set to NULL.
list | A pointer to the head of the t_executor linked list. |
void free_heap | ( | t_shell * | shell | ) |
Frees the memory used by the main data structure (shell environment).
Releases the memory allocated for the main data structure and it's components, including the environment list, readline input, etc.
[in,out] | shell | A pointer to the shell structure to be freed. |
t_lexer_list * free_lex | ( | t_lexer_list * | lex_head | ) |
Frees the allocated memory of a linked list of lexer elements.
Frees the memory of each node in the linked list, starting from the "lex_head" node. Also frees the allocated 'str' member of each node. The entire linked list is then freed and 'lex_head' is set to NULL.
lex_head | A pointer to the head of the lexer list. |
char ** free_str_arr | ( | char ** | arr | ) |
Frees the allocated memory of a string array.
Frees the memory of a string array by each string in the array.
arr | The pointer the the array of strings. |