1
0
forked from aniani/vim

patch 8.2.4898: Coverity complains about pointer usage

Problem:    Coverity complains about pointer usage.
Solution:   Move code for increment/decerment.
This commit is contained in:
Bram Moolenaar
2022-05-07 10:03:27 +01:00
parent 39be4981cd
commit 70d87690a3
2 changed files with 19 additions and 14 deletions

View File

@@ -746,6 +746,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4898,
/**/
4897,
/**/

View File

@@ -2018,6 +2018,20 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
lhs.lhs_name = NULL;
if (eap->cmdidx == CMD_increment || eap->cmdidx == CMD_decrement)
{
if (VIM_ISWHITE(eap->cmd[2]))
{
semsg(_(e_no_white_space_allowed_after_str_str),
eap->cmdidx == CMD_increment ? "++" : "--", eap->cmd);
return NULL;
}
op = (char_u *)(eap->cmdidx == CMD_increment ? "+=" : "-=");
oplen = 2;
incdec = TRUE;
}
else
{
sp = p;
p = skipwhite(p);
op = p;
@@ -2032,17 +2046,6 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
error_white_both(op, oplen);
return NULL;
}
if (eap->cmdidx == CMD_increment || eap->cmdidx == CMD_decrement)
{
if (VIM_ISWHITE(eap->cmd[2]))
{
semsg(_(e_no_white_space_allowed_after_str_str),
eap->cmdidx == CMD_increment ? "++" : "--", eap->cmd);
return NULL;
}
op = (char_u *)(eap->cmdidx == CMD_increment ? "+=" : "-=");
oplen = 2;
incdec = TRUE;
}
if (heredoc)