Fix warnings: edit.c: ins_compl_get_exp(): Np dereference (2): FP.

Problems   : Dereference of null pointer @ 3615.
             Dereference of null pointer @ 3764.
Diagnostic : False positives.
Rationale  : `ins_buf` is local static, so maintains value between calls.
             This function will be called first when `compl_started` is
             false, and in that case it initializes `ins_buf`. After
             that, it can be called multiple times with `compl_started`
             true, where `ins_buf` will be updated but not to null.
             So, when arriving to both points, `ins_buf` should never be
             null.
Resolution : Assert `ins_buf` at both points.
This commit is contained in:
Eliseo Martínez 2014-11-05 21:54:30 +01:00
parent 0bda79a847
commit da4c9447a4

View File

@ -3613,6 +3613,7 @@ static int ins_compl_get_exp(pos_T *ini)
* If 'infercase' is set, don't use 'smartcase' here
*/
save_p_scs = p_scs;
assert(ins_buf);
if (ins_buf->b_p_inf)
p_scs = FALSE;
@ -3761,8 +3762,10 @@ static int ins_compl_get_exp(pos_T *ini)
compl_started = TRUE;
} else {
/* Mark a buffer scanned when it has been scanned completely */
if (type == 0 || type == CTRL_X_PATH_PATTERNS)
if (type == 0 || type == CTRL_X_PATH_PATTERNS) {
assert(ins_buf);
ins_buf->b_scanned = TRUE;
}
compl_started = FALSE;
}