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.
This commit is contained in:
ZyX
2018-04-22 20:13:55 +03:00
parent e724667ef4
commit 3f4ec1aed2

View File

@@ -2825,10 +2825,11 @@ 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);
}
result->col = col;
@@ -2870,12 +2871,14 @@ 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);
}
result->col = col;