From 21c27fdcaea6a8c679c557e38ec09b865f01bd62 Mon Sep 17 00:00:00 2001 From: bket Date: Thu, 11 Dec 2025 04:17:17 +0000 Subject: [PATCH] Simplify argument move using TAILQ_CONCAT() Replace the manual loop moving each argument from cmd->arguments to last->arguments with a single TAILQ_CONCAT() call. This makes the code clearer and more efficient, while preserving identical behavior. OK nicm@ --- cmd-parse.y | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd-parse.y b/cmd-parse.y index 4cd8a420..215943b1 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -758,7 +758,7 @@ static int cmd_parse_expand_alias(struct cmd_parse_command *cmd, struct cmd_parse_input *pi, struct cmd_parse_result *pr) { - struct cmd_parse_argument *arg, *arg1, *first; + struct cmd_parse_argument *first; struct cmd_parse_commands *cmds; struct cmd_parse_command *last; char *alias, *name, *cause; @@ -798,10 +798,7 @@ cmd_parse_expand_alias(struct cmd_parse_command *cmd, TAILQ_REMOVE(&cmd->arguments, first, entry); cmd_parse_free_argument(first); - TAILQ_FOREACH_SAFE(arg, &cmd->arguments, entry, arg1) { - TAILQ_REMOVE(&cmd->arguments, arg, entry); - TAILQ_INSERT_TAIL(&last->arguments, arg, entry); - } + TAILQ_CONCAT(&last->arguments, &cmd->arguments, entry); cmd_parse_log_commands(cmds, __func__); pi->flags |= CMD_PARSE_NOALIAS;