summaryrefslogtreecommitdiffstats
path: root/cmd-parse.y
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:34:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:34:56 +0000
commitc294c2bf54a3ec56271a78c284f84e75a8119731 (patch)
treef1fed2d81b80619666e9508fa5051bcfc34fae5f /cmd-parse.y
parentReleasing progress-linux version 3.3a-5~progress7.99u1. (diff)
downloadtmux-c294c2bf54a3ec56271a78c284f84e75a8119731.tar.xz
tmux-c294c2bf54a3ec56271a78c284f84e75a8119731.zip
Merging upstream version 3.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmd-parse.y')
-rw-r--r--cmd-parse.y20
1 files changed, 16 insertions, 4 deletions
diff --git a/cmd-parse.y b/cmd-parse.y
index 1d69277..65ffad8 100644
--- a/cmd-parse.y
+++ b/cmd-parse.y
@@ -1086,7 +1086,8 @@ cmd_parse_from_arguments(struct args_value *values, u_int count,
arg->type = CMD_PARSE_STRING;
arg->string = copy;
TAILQ_INSERT_TAIL(&cmd->arguments, arg, entry);
- }
+ } else
+ free(copy);
} else if (values[i].type == ARGS_COMMANDS) {
arg = xcalloc(1, sizeof *arg);
arg->type = CMD_PARSE_PARSED_COMMANDS;
@@ -1614,13 +1615,24 @@ yylex_token(int ch)
for (;;) {
/* EOF or \n are always the end of the token. */
- if (ch == EOF || (state == NONE && ch == '\n'))
+ if (ch == EOF) {
+ log_debug("%s: end at EOF", __func__);
+ break;
+ }
+ if (state == NONE && ch == '\n') {
+ log_debug("%s: end at EOL", __func__);
break;
+ }
/* Whitespace or ; or } ends a token unless inside quotes. */
- if ((ch == ' ' || ch == '\t' || ch == ';' || ch == '}') &&
- state == NONE)
+ if (state == NONE && (ch == ' ' || ch == '\t')) {
+ log_debug("%s: end at WS", __func__);
+ break;
+ }
+ if (state == NONE && (ch == ';' || ch == '}')) {
+ log_debug("%s: end at %c", __func__, ch);
break;
+ }
/*
* Spaces and comments inside quotes after \n are removed but