aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_eval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-14 09:11:37 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-14 09:42:59 +0800
commit8e2903d2fe810cfa3be41fc1e7a4d8394c84cf11 (patch)
tree3a18b8a3e608394451044181ca4368133635027d /src/nvim/ex_eval.c
parentbd83b587b18bb6f2ac555a992fa5b7d907de7e79 (diff)
downloadrneovim-8e2903d2fe810cfa3be41fc1e7a4d8394c84cf11.tar.gz
rneovim-8e2903d2fe810cfa3be41fc1e7a4d8394c84cf11.tar.bz2
rneovim-8e2903d2fe810cfa3be41fc1e7a4d8394c84cf11.zip
vim-patch:8.2.1049: Vim9: leaking memory when using continuation line
Problem: Vim9: leaking memory when using continuation line. Solution: Keep a pointer to the continuation line in evalarg_T. Centralize checking for a next command. https://github.com/vim/vim/commit/b171fb179053fa631fec74911b5fb9374cb6a8a1 Omit eval_next_line(): Vim9 script only. vim-patch:8.2.1050: missing change in struct Problem: Missing change in struct. Solution: Add missing change. https://github.com/vim/vim/commit/65a8ed37f7bc61fbe5c612a7b0eb0dfc16ad3e11 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/ex_eval.c')
-rw-r--r--src/nvim/ex_eval.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 33b315c179..27f012a4ab 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -796,7 +796,7 @@ void ex_eval(exarg_T *eap)
.eval_flags = eap->skip ? 0 : EVAL_EVALUATE,
.eval_cookie = eap->getline == getsourceline ? eap->cookie : NULL,
};
- if (eval0(eap->arg, &tv, &eap->nextcmd, &evalarg) == OK) {
+ if (eval0(eap->arg, &tv, eap, &evalarg) == OK) {
tv_clear(&tv);
}
}
@@ -815,7 +815,7 @@ void ex_if(exarg_T *eap)
int skip = CHECK_SKIP;
bool error;
- int result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
+ int result = eval_to_bool(eap->arg, &error, eap, skip);
if (!skip && !error) {
if (result) {
@@ -910,7 +910,7 @@ void ex_else(exarg_T *eap)
if (skip && *eap->arg != '"' && ends_excmd(*eap->arg)) {
semsg(_(e_invexpr2), eap->arg);
} else {
- result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
+ result = eval_to_bool(eap->arg, &error, eap, skip);
}
// When throwing error exceptions, we want to throw always the first
@@ -957,7 +957,7 @@ void ex_while(exarg_T *eap)
int skip = CHECK_SKIP;
if (eap->cmdidx == CMD_while) {
// ":while bool-expr"
- result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
+ result = eval_to_bool(eap->arg, &error, eap, skip);
} else {
void *fi;
@@ -969,7 +969,7 @@ void ex_while(exarg_T *eap)
error = false;
} else {
// Evaluate the argument and get the info in a structure.
- fi = eval_for_line(eap->arg, &error, &eap->nextcmd, skip);
+ fi = eval_for_line(eap->arg, &error, eap, skip);
cstack->cs_forinfo[cstack->cs_idx] = fi;
}
@@ -1128,12 +1128,11 @@ void ex_endwhile(exarg_T *eap)
/// Handle ":throw expr"
void ex_throw(exarg_T *eap)
{
- const char *arg = eap->arg;
+ char *arg = eap->arg;
char *value;
if (*arg != NUL && *arg != '|' && *arg != '\n') {
- value = eval_to_string_skip(arg, (const char **)&eap->nextcmd,
- (bool)eap->skip);
+ value = eval_to_string_skip(arg, eap, eap->skip);
} else {
emsg(_(e_argreq));
value = NULL;