]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4898: Coverity complains about pointer usage v8.2.4898
authorBram Moolenaar <Bram@vim.org>
Sat, 7 May 2022 09:03:27 +0000 (10:03 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 7 May 2022 09:03:27 +0000 (10:03 +0100)
Problem:    Coverity complains about pointer usage.
Solution:   Move code for increment/decerment.

src/version.c
src/vim9compile.c

index be7bb22f815b2bfd77e120bb20d8e702153b44b6..201d26f06eb9a36bf13c21ca431480e68df5fd5e 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4898,
 /**/
     4897,
 /**/
index 9b7108b83fa718b9c2bcf5a4127859566831fba3..15dab9862e0cb41ebef2a977796151b422cc3ea7 100644 (file)
@@ -2018,20 +2018,6 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
 
     lhs.lhs_name = NULL;
 
-    sp = p;
-    p = skipwhite(p);
-    op = p;
-    oplen = assignment_len(p, &heredoc);
-
-    if (var_count > 0 && oplen == 0)
-       // can be something like "[1, 2]->func()"
-       return arg;
-
-    if (oplen > 0 && (!VIM_ISWHITE(*sp) || !IS_WHITE_OR_NUL(op[oplen])))
-    {
-       error_white_both(op, oplen);
-       return NULL;
-    }
     if (eap->cmdidx == CMD_increment || eap->cmdidx == CMD_decrement)
     {
        if (VIM_ISWHITE(eap->cmd[2]))
@@ -2044,6 +2030,23 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
        oplen = 2;
        incdec = TRUE;
     }
+    else
+    {
+       sp = p;
+       p = skipwhite(p);
+       op = p;
+       oplen = assignment_len(p, &heredoc);
+
+       if (var_count > 0 && oplen == 0)
+           // can be something like "[1, 2]->func()"
+           return arg;
+
+       if (oplen > 0 && (!VIM_ISWHITE(*sp) || !IS_WHITE_OR_NUL(op[oplen])))
+       {
+           error_white_both(op, oplen);
+           return NULL;
+       }
+    }
 
     if (heredoc)
     {