summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-04-21 12:19:35 +0200
committerBram Moolenaar <Bram@vim.org>2021-04-21 12:19:35 +0200
commit169502fb0beb7eb21f72d6c4590483c069353b53 (patch)
treeb6d1fa8f6ecbcfb22ad356e4ff5fd2c04025ffa8 /src/vim9compile.c
parent16678eb50f7fcb7138600bd0364edb2c9def8cb8 (diff)
downloadvim-git-169502fb0beb7eb21f72d6c4590483c069353b53.tar.gz
patch 8.2.2795: Coverity warns for not using return valuev8.2.2795
Problem: Coverity warns for not using return value. Solution: Check the return value of compiling the substitute expression.
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index ade86aa5c..4b81f3f1b 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -6511,7 +6511,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
{
// skip over the "=" and the expression
p = skipwhite(op + oplen);
- compile_expr0(&p, cctx);
+ (void)compile_expr0(&p, cctx);
}
}
else if (oplen > 0)
@@ -8525,6 +8525,7 @@ compile_substitute(char_u *arg, exarg_T *eap, cctx_T *cctx)
{
garray_T save_ga = cctx->ctx_instr;
char_u *end;
+ int expr_res;
int trailing_error;
int instr_count;
isn_T *instr = NULL;
@@ -8538,13 +8539,14 @@ compile_substitute(char_u *arg, exarg_T *eap, cctx_T *cctx)
cctx->ctx_instr.ga_len = 0;
cctx->ctx_instr.ga_maxlen = 0;
cctx->ctx_instr.ga_data = NULL;
- compile_expr0(&cmd, cctx);
+ expr_res = compile_expr0(&cmd, cctx);
if (end[-1] == NUL)
end[-1] = delimiter;
cmd = skipwhite(cmd);
trailing_error = *cmd != delimiter && *cmd != NUL;
- if (trailing_error || ga_grow(&cctx->ctx_instr, 1) == FAIL)
+ if (expr_res == FAIL || trailing_error
+ || ga_grow(&cctx->ctx_instr, 1) == FAIL)
{
if (trailing_error)
semsg(_(e_trailing_arg), cmd);