mirror of
https://github.com/neovim/neovim.git
synced 2025-11-24 19:20:39 +00:00
Fix warnings: ex_getln.c: init_history(): Nonnull attr passed null: HI.
Problem : Argument with 'nonnull' attribute passed null @ 4227.
Diagnostic : Harmless issue.
Rationale : It's true we're calling memset with NULL pointer, but it's
also true we're doing it with zero size. We just thought
that would work and do nothing (it was a way of avoiding
to add a guard). It doesn't work, though, as memset
requires nonnull arguments.
Resolution : Add guard to avoid null argument.
This commit is contained in:
@@ -4239,7 +4239,9 @@ void init_history(void)
|
|||||||
|
|
||||||
// clear remaining space, if any
|
// clear remaining space, if any
|
||||||
int l3 = j < 0 ? 0 : MIN(newlen, oldlen); // number of copied entries
|
int l3 = j < 0 ? 0 : MIN(newlen, oldlen); // number of copied entries
|
||||||
memset(temp + l3, 0, (size_t)(newlen - l3) * sizeof(*temp));
|
if (newlen) {
|
||||||
|
memset(temp + l3, 0, (size_t)(newlen - l3) * sizeof(*temp));
|
||||||
|
}
|
||||||
|
|
||||||
hisidx[type] = l3 - 1;
|
hisidx[type] = l3 - 1;
|
||||||
xfree(history[type]);
|
xfree(history[type]);
|
||||||
|
|||||||
Reference in New Issue
Block a user