vim-patch:8.2.1102: Coverity gets confused by an unnecessary NULL check

Problem:    Coverity gets confused by an unnecessary NULL check.
Solution:   Remove the check for NULL.
9004949221
This commit is contained in:
Jan Edmund Lazo 2020-10-24 22:28:56 -04:00
parent a67bcb3fbf
commit b7cd7e0e5c
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
2 changed files with 17 additions and 14 deletions

View File

@ -8147,15 +8147,17 @@ static void f_setline(typval_T *argvars, typval_T *rettv, FunPtr fptr)
/// Create quickfix/location list from VimL values
///
/// Used by `setqflist()` and `setloclist()` functions. Accepts invalid
/// list_arg, action_arg and what_arg arguments in which case errors out,
/// including VAR_UNKNOWN parameters.
/// args argument in which case errors out, including VAR_UNKNOWN parameters.
///
/// @param[in,out] wp Window to create location list for. May be NULL in
/// which case quickfix list will be created.
/// @param[in] list_arg Quickfix list contents.
/// @param[in] action_arg Action to perform: append to an existing list,
/// replace its content or create a new one.
/// @param[in] title_arg New list title. Defaults to caller function name.
/// @param[in] args [list, action, what]
/// @param[in] args[0] Quickfix list contents.
/// @param[in] args[1] Optional. Action to perform:
/// append to an existing list, replace its content,
/// or create a new one.
/// @param[in] args[2] Optional. Quickfix list properties or title.
/// Defaults to caller function name.
/// @param[out] rettv Return value: 0 in case of success, -1 otherwise.
static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
FUNC_ATTR_NONNULL_ARG(2, 3)
@ -8165,7 +8167,7 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
int action = ' ';
static int recursive = 0;
rettv->vval.v_number = -1;
dict_T *d = NULL;
dict_T *what = NULL;
typval_T *list_arg = &args[0];
if (list_arg->v_type != VAR_LIST) {
@ -8193,18 +8195,18 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
return;
}
typval_T *title_arg = &args[2];
if (title_arg->v_type == VAR_UNKNOWN) {
typval_T *const what_arg = &args[2];
if (what_arg->v_type == VAR_UNKNOWN) {
// Option argument was not given.
goto skip_args;
} else if (title_arg->v_type == VAR_STRING) {
title = tv_get_string_chk(title_arg);
} else if (what_arg->v_type == VAR_STRING) {
title = tv_get_string_chk(what_arg);
if (!title) {
// Type error. Error already printed by tv_get_string_chk().
return;
}
} else if (title_arg->v_type == VAR_DICT) {
d = title_arg->vval.v_dict;
} else if (what_arg->v_type == VAR_DICT && what_arg->vval.v_dict != NULL) {
what = what_arg->vval.v_dict;
} else {
EMSG(_(e_dictreq));
return;
@ -8217,7 +8219,7 @@ skip_args:
recursive++;
list_T *const l = list_arg->vval.v_list;
if (set_errorlist(wp, l, action, (char_u *)title, d) == OK) {
if (set_errorlist(wp, l, action, (char_u *)title, what) == OK) {
rettv->vval.v_number = 0;
}
recursive--;

View File

@ -6317,6 +6317,7 @@ static void qf_free_stack(win_T *wp, qf_info_T *qi)
// Populate the quickfix list with the items supplied in the list
// of dictionaries. "title" will be copied to w:quickfix_title
// "action" is 'a' for add, 'r' for replace. Otherwise create a new list.
// When "what" is not NULL then only set some properties.
int set_errorlist(win_T *wp, list_T *list, int action, char_u *title,
dict_T *what)
{