diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 03:34:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 03:34:56 +0000 |
commit | 28b8b866c574d712aa5b814b000bc490c89e603e (patch) | |
tree | bc842acf3aab38f2e66e8812a18d6106a5d9bae1 /cmd-parse.c | |
parent | Adding upstream version 3.3a. (diff) | |
download | tmux-28b8b866c574d712aa5b814b000bc490c89e603e.tar.xz tmux-28b8b866c574d712aa5b814b000bc490c89e603e.zip |
Adding upstream version 3.4.upstream/3.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmd-parse.c')
-rw-r--r-- | cmd-parse.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/cmd-parse.c b/cmd-parse.c index 309c6fe..4be4890 100644 --- a/cmd-parse.c +++ b/cmd-parse.c @@ -845,7 +845,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; @@ -1373,13 +1374,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 @@ -1462,7 +1474,7 @@ error: free(buf); return (NULL); } -#line 1458 "cmd-parse.c" +#line 1470 "cmd-parse.c" /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack(void) { @@ -2156,7 +2168,7 @@ case 46: free(yyvsp[-1].commands); } break; -#line 2152 "cmd-parse.c" +#line 2164 "cmd-parse.c" } yyssp -= yym; yystate = *yyssp; |