patch 8.2.4898: Coverity complains about pointer usage
Problem: Coverity complains about pointer usage.
Solution: Move code for increment/decerment.
diff --git a/src/version.c b/src/version.c
index be7bb22..201d26f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4898,
+/**/
4897,
/**/
4896,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 9b7108b..15dab98 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2018,20 +2018,6 @@
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 @@
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)
{