refactor cmdlist.num_cmds -> cmdlist.num_cmd to be more consistent

This commit is contained in:
Khaïs COLIN 2025-03-19 16:26:45 +01:00
parent 448458b37f
commit 88ed66e138
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
7 changed files with 27 additions and 27 deletions

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/24 17:49:46 by khais #+# #+# */
/* Updated: 2025/03/18 15:52:43 by khais ### ########.fr */
/* Updated: 2025/03/19 16:43:14 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -106,7 +106,7 @@ void cmdlist_destroy(t_cmdlist *cmd)
if (cmd == NULL)
return ;
i = 0;
while (i < cmd->num_cmds)
while (i < cmd->num_cmd)
{
cmdlist_item_destroy(cmd->cmds[i]);
i++;

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/24 17:45:01 by khais #+# #+# */
/* Updated: 2025/03/19 12:12:12 by khais ### ########.fr */
/* Updated: 2025/03/19 16:43:14 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -71,7 +71,7 @@ typedef struct s_cmdlist
/*
** Number of commands in this command list.
*/
int num_cmds;
int num_cmd;
/*
** Operators that separate the pipelines.
**

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/26 13:51:18 by khais #+# #+# */
/* Updated: 2025/03/18 15:03:41 by khais ### ########.fr */
/* Updated: 2025/03/19 16:43:14 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -53,13 +53,13 @@ static t_cmdlist *allocate_cmdlist(t_wordlist *words)
output = ft_calloc(1, sizeof(t_cmdlist));
if (output == NULL)
return (NULL);
output->num_cmds = cmdlist_count_pipelines(words);
output->num_cmd = cmdlist_count_pipelines(words);
output->cmds
= ft_calloc(output->num_cmds, sizeof(struct s_cmdlist_item **));
= ft_calloc(output->num_cmd, sizeof(struct s_cmdlist_item **));
if (output->cmds == NULL)
return (free(output), NULL);
output->operators
= ft_calloc(output->num_cmds, sizeof(t_operator));
= ft_calloc(output->num_cmd, sizeof(t_operator));
if (output->operators == NULL)
return (free(output->cmds), free(output), NULL);
return (output);
@ -100,5 +100,5 @@ void cmdlist_builder_next_word(
*/
bool cmdlist_builder_at_last_pipeline(t_cmdlist_builder *builder)
{
return (builder->idx == builder->cmdlist->num_cmds - 1);
return (builder->idx == builder->cmdlist->num_cmd - 1);
}

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/18 15:52:28 by khais #+# #+# */
/* Updated: 2025/03/19 14:43:39 by khais ### ########.fr */
/* Updated: 2025/03/19 16:43:14 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -43,12 +43,12 @@ void cmdlist_debug(t_cmdlist *cmd, t_buffer *leader, bool is_last)
ft_printf("%s\n", "t_cmdlist");
i = 0;
last = false;
if (cmd->num_cmds == 0)
if (cmd->num_cmd == 0)
last = true;
cmdlist_num_cmds_debug(cmd->num_cmds, leader, last);
while (i < cmd->num_cmds)
cmdlist_num_cmds_debug(cmd->num_cmd, leader, last);
while (i < cmd->num_cmd)
{
if (i == cmd->num_cmds - 1)
if (i == cmd->num_cmd - 1)
last = true;
cmdlist_array_debug(cmd, i, leader, last);
i++;

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/19 16:37:09 by khais #+# #+# */
/* Updated: 2025/03/19 18:40:04 by khais ### ########.fr */
/* Updated: 2025/03/20 11:56:28 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -57,7 +57,7 @@ static t_cmdlist *cmdlist_parse_redirections(t_cmdlist *cmd)
if (cmd == NULL)
return (NULL);
i = 0;
while (i < cmd->num_cmds)
while (i < cmd->num_cmd)
{
if (cmdlist_item_parse_redirections(cmd->cmds[i]) == NULL)
return (NULL);