Mercurial > vim
comparison src/viminfo.c @ 17502:bc6088919610 v8.1.1749
patch 8.1.1749: Coverity warns for using negative index
commit https://github.com/vim/vim/commit/736cd2cfbe83b85259eecc7d70e68297ce968d33
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 25 21:58:19 2019 +0200
patch 8.1.1749: Coverity warns for using negative index
Problem: Coverity warns for using negative index.
Solution: Move using index inside "if".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 25 Jul 2019 22:00:05 +0200 |
parents | d4b2a212fa2f |
children | 9efb4dda9720 |
comparison
equal
deleted
inserted
replaced
17501:ee0183fdf5f8 | 17502:bc6088919610 |
---|---|
1418 else if (lp[0] == 'h') // ~h: 'hlsearch' highlighting off | 1418 else if (lp[0] == 'h') // ~h: 'hlsearch' highlighting off |
1419 hlsearch_on = FALSE; | 1419 hlsearch_on = FALSE; |
1420 else if (lp[0] == 'H') // ~H: 'hlsearch' highlighting on | 1420 else if (lp[0] == 'H') // ~H: 'hlsearch' highlighting on |
1421 hlsearch_on = TRUE; | 1421 hlsearch_on = TRUE; |
1422 #endif | 1422 #endif |
1423 spat = get_spat(idx); | |
1424 if (idx >= 0) | 1423 if (idx >= 0) |
1425 { | 1424 { |
1425 spat = get_spat(idx); | |
1426 if (force || spat->pat == NULL) | 1426 if (force || spat->pat == NULL) |
1427 { | 1427 { |
1428 val = viminfo_readstring(virp, (int)(lp - virp->vir_line + 1), | 1428 val = viminfo_readstring(virp, (int)(lp - virp->vir_line + 1), |
1429 TRUE); | 1429 TRUE); |
1430 if (val != NULL) | 1430 if (val != NULL) |