command list refactor: rename t_command_list to t_cmdlist

This commit is contained in:
Khaïs COLIN 2025-02-25 15:15:23 +01:00 committed by Khaïs COLIN
parent 659c9f57ff
commit 5fceb4713d
3 changed files with 33 additions and 33 deletions

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/24 17:49:46 by khais #+# #+# */
/* Updated: 2025/02/25 15:08:48 by khais ### ########.fr */
/* Updated: 2025/02/25 15:25:14 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -60,13 +60,13 @@ static int command_list_count_pipelines(t_wordlist *words)
**
** Handles malloc error.
*/
static t_command_list *allocate_command_list(t_wordlist *words)
static t_cmdlist *allocate_command_list(t_wordlist *words)
{
t_command_list *output;
t_cmdlist *output;
if (words == NULL)
return (NULL);
output = ft_calloc(1, sizeof(t_command_list));
output = ft_calloc(1, sizeof(t_cmdlist));
if (output == NULL)
return (NULL);
output->num_pipelines = command_list_count_pipelines(words);
@ -84,12 +84,12 @@ static t_command_list *allocate_command_list(t_wordlist *words)
/*
** Create a new command list from the given wordlist.
*/
t_command_list *command_list_from_wordlist(t_wordlist *words)
t_cmdlist *cmdlist_from_wordlist(t_wordlist *words)
{
t_command_list *output;
t_wordlist *current_wordlist;
t_worddesc *current_word;
int idx;
t_cmdlist *output;
t_wordlist *current_wordlist;
t_worddesc *current_word;
int idx;
output = allocate_command_list(words);
if (output == NULL)
@ -125,7 +125,7 @@ t_command_list *command_list_from_wordlist(t_wordlist *words)
/*
** destroy the given command list and all associated memory
*/
void command_list_destroy(t_command_list *cmd)
void cmdlist_destroy(t_cmdlist *cmd)
{
int i;

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/24 17:45:01 by khais #+# #+# */
/* Updated: 2025/02/25 15:06:23 by khais ### ########.fr */
/* Updated: 2025/02/25 15:25:14 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -78,7 +78,7 @@ typedef enum e_operator
** The return status of AND and OR lists is the exit status of the last command
** executed in the list.
*/
typedef struct s_command_list
typedef struct s_cmdlist
{
/*
** List of pipelines contained in this command list.
@ -100,9 +100,9 @@ typedef struct s_command_list
** In example above, operators[1] == OP_END
*/
t_operator *operators;
} t_command_list;
} t_cmdlist;
t_command_list *command_list_from_wordlist(t_wordlist *words);
void command_list_destroy(t_command_list *cmd);
t_cmdlist *cmdlist_from_wordlist(t_wordlist *words);
void cmdlist_destroy(t_cmdlist *cmd);
#endif // COMMAND_LIST_H