gcc/analyzer: fix false positives for NULL (#13248)

Close https://github.com/neovim/neovim/issues/13158
This commit is contained in:
Jan Edmund Lazo
2020-11-08 22:48:17 -05:00
committed by GitHub
parent 94062831b3
commit 4e6f00dd29
4 changed files with 15 additions and 8 deletions

View File

@@ -2687,6 +2687,9 @@ void nvim__screenshot(String path)
static void clear_provider(DecorProvider *p)
{
if (p == NULL) {
return;
}
NLUA_CLEAR_REF(p->redraw_start);
NLUA_CLEAR_REF(p->redraw_buf);
NLUA_CLEAR_REF(p->redraw_win);

View File

@@ -159,8 +159,11 @@ static int conv_error(const char *const msg, const MPConvStack *const mpstack,
vim_snprintf((char *)IObuff, IOSIZE, idx_msg, idx);
ga_concat(&msg_ga, IObuff);
} else {
typval_T key_tv = *TV_LIST_ITEM_TV(
tv_list_first(TV_LIST_ITEM_TV(li)->vval.v_list));
assert(li != NULL);
listitem_T *const first_item =
tv_list_first(TV_LIST_ITEM_TV(li)->vval.v_list);
assert(first_item != NULL);
typval_T key_tv = *TV_LIST_ITEM_TV(first_item);
char *const key = encode_tv2echo(&key_tv, NULL);
vim_snprintf((char *) IObuff, IOSIZE, key_pair_msg, key, idx);
xfree(key);

View File

@@ -3451,13 +3451,13 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
sub_firstline = NULL;
/*
* ~ in the substitute pattern is replaced with the old pattern.
* We do it here once to avoid it to be replaced over and over again.
* But don't do it when it starts with "\=", then it's an expression.
*/
if (!(sub[0] == '\\' && sub[1] == '='))
// ~ in the substitute pattern is replaced with the old pattern.
// We do it here once to avoid it to be replaced over and over again.
// But don't do it when it starts with "\=", then it's an expression.
assert(sub != NULL);
if (!(sub[0] == '\\' && sub[1] == '=')) {
sub = regtilde(sub, p_magic);
}
// Check for a match on each line.
// If preview: limit to max('cmdwinheight', viewport).

View File

@@ -74,6 +74,7 @@ uint64_t extmark_set(buf_T *buf, uint64_t ns_id, uint64_t id,
Decoration *decor, ExtmarkOp op)
{
ExtmarkNs *ns = buf_ns_ref(buf, ns_id, true);
assert(ns != NULL);
mtpos_t old_pos;
uint64_t mark = 0;