vim-patch:8.1.0501: cppcheck warns for using array index before bounds check (#9178)

Problem:    Cppcheck warns for using array index before bounds check.
Solution:   Swap the conditions. (Dominique Pelle)
a9a8e04eab
This commit is contained in:
Jan Edmund Lazo 2018-11-01 04:53:46 -04:00 committed by Justin M. Keyes
parent b24209dcf5
commit f9fe903579

View File

@ -3709,9 +3709,9 @@ static void ml_updatechunk(buf_T *buf, linenr_T line, long len, int updtype)
curix++) {
curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines;
}
} else if (line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines
&& curix < buf->b_ml.ml_usedchunks - 1) {
/* Adjust cached curix & curline */
} else if (curix < buf->b_ml.ml_usedchunks - 1
&& line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines) {
// Adjust cached curix & curline
curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines;
curix++;
}