aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2018-04-22 20:13:55 +0300
committerZyX <kp-pav@yandex.ru>2018-04-22 20:15:42 +0300
commit3f4ec1aed22d9088e6f300b0c760533652ab3804 (patch)
treefb1383c0fc675609c830236be62263b88bbc05e0
parente724667ef47e187a1115532d866af1dada4f24ae (diff)
downloadrneovim-3f4ec1aed22d9088e6f300b0c760533652ab3804.tar.gz
rneovim-3f4ec1aed22d9088e6f300b0c760533652ab3804.tar.bz2
rneovim-3f4ec1aed22d9088e6f300b0c760533652ab3804.zip
syntax: Fix PVS/V547: condition was checked
In surrounding if() `off` was checked for being non-zero and in previous if() it was checked for being positive.
-rw-r--r--src/nvim/syntax.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 65ae38718e..577d9f497c 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -2825,9 +2825,10 @@ syn_add_end_off (
if (off > 0) {
while (off-- > 0 && *p != NUL)
mb_ptr_adv(p);
- } else if (off < 0) {
- while (off++ < 0 && base < p)
+ } else {
+ while (off++ < 0 && base < p) {
mb_ptr_back(base, p);
+ }
}
col = (int)(p - base);
}
@@ -2870,11 +2871,13 @@ syn_add_start_off (
base = ml_get_buf(syn_buf, result->lnum, FALSE);
p = base + col;
if (off > 0) {
- while (off-- && *p != NUL)
+ while (off-- && *p != NUL) {
mb_ptr_adv(p);
- } else if (off < 0) {
- while (off++ && base < p)
+ }
+ } else {
+ while (off++ && base < p) {
mb_ptr_back(base, p);
+ }
}
col = (int)(p - base);
}