diff options
author | ZyX <kp-pav@yandex.ru> | 2018-04-22 19:09:20 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2018-04-22 19:09:20 +0300 |
commit | adfc1212b57af759af2d67db399916f13b1cc2b0 (patch) | |
tree | 708a959d1a9f234886cf4a815618f9b34e93a8b3 | |
parent | 190cc43cf38c0231f4672c52b60725ba173131f8 (diff) | |
download | rneovim-adfc1212b57af759af2d67db399916f13b1cc2b0.tar.gz rneovim-adfc1212b57af759af2d67db399916f13b1cc2b0.tar.bz2 rneovim-adfc1212b57af759af2d67db399916f13b1cc2b0.zip |
regexp_nfa: Silence PVS/V560: current code is more obvious
While warning is technically true (cannot enter this case with `state->c`
greater then NFA_Z…9) it makes condition less readable and relies on knownledge
of enum internal structure.
-rw-r--r-- | src/nvim/regexp_nfa.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index c520ef5fb9..98fae858f6 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -4117,7 +4117,7 @@ skip_add: if (state->c == NFA_ZSTART) { subidx = 0; sub = &subs->norm; - } else if (state->c >= NFA_ZOPEN && state->c <= NFA_ZOPEN9) { + } else if (state->c >= NFA_ZOPEN && state->c <= NFA_ZOPEN9) { // -V560 subidx = state->c - NFA_ZOPEN; sub = &subs->synt; } else { @@ -4169,11 +4169,12 @@ skip_add: } subs = addstate(l, state->out, subs, pim, off_arg); - /* "subs" may have changed, need to set "sub" again */ - if (state->c >= NFA_ZOPEN && state->c <= NFA_ZOPEN9) + // "subs" may have changed, need to set "sub" again. + if (state->c >= NFA_ZOPEN && state->c <= NFA_ZOPEN9) { // -V560 sub = &subs->synt; - else + } else { sub = &subs->norm; + } if (save_in_use == -1) { if (REG_MULTI) { @@ -4217,7 +4218,7 @@ skip_add: if (state->c == NFA_ZEND) { subidx = 0; sub = &subs->norm; - } else if (state->c >= NFA_ZCLOSE && state->c <= NFA_ZCLOSE9) { + } else if (state->c >= NFA_ZCLOSE && state->c <= NFA_ZCLOSE9) { // -V560 subidx = state->c - NFA_ZCLOSE; sub = &subs->synt; } else { @@ -4250,11 +4251,12 @@ skip_add: } subs = addstate(l, state->out, subs, pim, off_arg); - /* "subs" may have changed, need to set "sub" again */ - if (state->c >= NFA_ZCLOSE && state->c <= NFA_ZCLOSE9) + // "subs" may have changed, need to set "sub" again. + if (state->c >= NFA_ZCLOSE && state->c <= NFA_ZCLOSE9) { // -V560 sub = &subs->synt; - else + } else { sub = &subs->norm; + } if (REG_MULTI) { sub->list.multi[subidx] = save_multipos; |