aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-04-16 21:22:02 +0300
committerZyX <kp-pav@yandex.ru>2017-04-16 21:43:23 +0300
commit48ad8e0ff1ba721a5607c20f48e813400041299c (patch)
treedcd300a0b45b6ea113360db61e20ec7936f3f7e0
parent7cf4b0ac06c7d6675a05924b6aff3850fde3bcf2 (diff)
downloadrneovim-48ad8e0ff1ba721a5607c20f48e813400041299c.tar.gz
rneovim-48ad8e0ff1ba721a5607c20f48e813400041299c.tar.bz2
rneovim-48ad8e0ff1ba721a5607c20f48e813400041299c.zip
screen: Silence NULL dereference false positive
Based on the loop condition when shl_flag is true cur != NULL.
-rw-r--r--src/nvim/screen.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index cf116e1930..db757a54f5 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -2579,13 +2579,14 @@ win_line (
* Do this for both search_hl and the match list.
*/
cur = wp->w_match_head;
- shl_flag = FALSE;
- while (cur != NULL || shl_flag == FALSE) {
- if (shl_flag == FALSE) {
+ shl_flag = false;
+ while (cur != NULL || !shl_flag) {
+ if (!shl_flag) {
shl = &search_hl;
- shl_flag = TRUE;
- } else
- shl = &cur->hl;
+ shl_flag = true;
+ } else {
+ shl = &cur->hl; // -V595
+ }
shl->startcol = MAXCOL;
shl->endcol = MAXCOL;
shl->attr_cur = 0;
@@ -5536,13 +5537,14 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum)
* Do this both for search_hl and the match list.
*/
cur = wp->w_match_head;
- shl_flag = FALSE;
- while (cur != NULL || shl_flag == FALSE) {
- if (shl_flag == FALSE) {
+ shl_flag = false;
+ while (cur != NULL || shl_flag == false) {
+ if (shl_flag == false) {
shl = &search_hl;
- shl_flag = TRUE;
- } else
- shl = &cur->hl;
+ shl_flag = true;
+ } else {
+ shl = &cur->hl; // -V595
+ }
if (shl->rm.regprog != NULL
&& shl->lnum == 0
&& re_multiline(shl->rm.regprog)) {