Mercurial > vim
changeset 28747:fb86364889a4 v8.2.4898
patch 8.2.4898: Coverity complains about pointer usage
Commit: https://github.com/vim/vim/commit/70d87690a39222277c2beab0649e343a78dee908
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 7 10:03:27 2022 +0100
patch 8.2.4898: Coverity complains about pointer usage
Problem: Coverity complains about pointer usage.
Solution: Move code for increment/decerment.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 07 May 2022 11:15:03 +0200 |
parents | c6400ec5d91d |
children | 2a275e203f8b |
files | src/version.c src/vim9compile.c |
diffstat | 2 files changed, 19 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4898, +/**/ 4897, /**/ 4896,
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -2018,20 +2018,6 @@ compile_assignment(char_u *arg, exarg_T 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 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) {