mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
regexp: Silence V595: potential null dereference
The code uses 2-iteration loop antipattern: retval is NULL on first iteration, not NULL on second, yet this is still a false positive.
This commit is contained in:
parent
6552768c4f
commit
f81d1ce003
@ -6928,9 +6928,10 @@ char_u *reg_submatch(int no)
|
|||||||
STRNCPY(retval + len, reg_getline_submatch(lnum),
|
STRNCPY(retval + len, reg_getline_submatch(lnum),
|
||||||
submatch_mmatch->endpos[no].col);
|
submatch_mmatch->endpos[no].col);
|
||||||
len += submatch_mmatch->endpos[no].col;
|
len += submatch_mmatch->endpos[no].col;
|
||||||
if (round == 2)
|
if (round == 2) {
|
||||||
retval[len] = NUL;
|
retval[len] = NUL; // -V595
|
||||||
++len;
|
}
|
||||||
|
len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval == NULL) {
|
if (retval == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user