mirror of
https://github.com/tmux/tmux.git
synced 2025-12-17 00:02:23 -05:00
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@
This commit is contained in:
parent
672e89a640
commit
21c27fdcae
@ -758,7 +758,7 @@ static int
|
|||||||
cmd_parse_expand_alias(struct cmd_parse_command *cmd,
|
cmd_parse_expand_alias(struct cmd_parse_command *cmd,
|
||||||
struct cmd_parse_input *pi, struct cmd_parse_result *pr)
|
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_commands *cmds;
|
||||||
struct cmd_parse_command *last;
|
struct cmd_parse_command *last;
|
||||||
char *alias, *name, *cause;
|
char *alias, *name, *cause;
|
||||||
@ -798,10 +798,7 @@ cmd_parse_expand_alias(struct cmd_parse_command *cmd,
|
|||||||
TAILQ_REMOVE(&cmd->arguments, first, entry);
|
TAILQ_REMOVE(&cmd->arguments, first, entry);
|
||||||
cmd_parse_free_argument(first);
|
cmd_parse_free_argument(first);
|
||||||
|
|
||||||
TAILQ_FOREACH_SAFE(arg, &cmd->arguments, entry, arg1) {
|
TAILQ_CONCAT(&last->arguments, &cmd->arguments, entry);
|
||||||
TAILQ_REMOVE(&cmd->arguments, arg, entry);
|
|
||||||
TAILQ_INSERT_TAIL(&last->arguments, arg, entry);
|
|
||||||
}
|
|
||||||
cmd_parse_log_commands(cmds, __func__);
|
cmd_parse_log_commands(cmds, __func__);
|
||||||
|
|
||||||
pi->flags |= CMD_PARSE_NOALIAS;
|
pi->flags |= CMD_PARSE_NOALIAS;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user