]> granicus.if.org Git - vim/commitdiff
patch 8.2.2795: Coverity warns for not using return value v8.2.2795
authorBram Moolenaar <Bram@vim.org>
Wed, 21 Apr 2021 10:19:35 +0000 (12:19 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 21 Apr 2021 10:19:35 +0000 (12:19 +0200)
Problem:    Coverity warns for not using return value.
Solution:   Check the return value of compiling the substitute expression.

src/version.c
src/vim9compile.c

index a0233352418b35c3d05e430b86565b1707c147f6..18d6c8069b792224bcdd0bb1347a33e5c19fc2b5 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2795,
 /**/
     2794,
 /**/
index ade86aa5c5209f756ecb50e12dfb987d0d069763..4b81f3f1b765d27e3b4247594e3aeac148081495 100644 (file)
@@ -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);