refactor: fix PVS warnings (#23200)

This commit is contained in:
zeertzjq 2023-04-19 22:49:14 +08:00 committed by GitHub
parent 0ad5237162
commit ea52961c54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 6 deletions

View File

@ -3484,7 +3484,7 @@ char *vim_gettempdir(void)
static int notfound = 0; static int notfound = 0;
bool exists = false; bool exists = false;
if (vim_tempdir == NULL || !(exists = os_isdir(vim_tempdir))) { if (vim_tempdir == NULL || !(exists = os_isdir(vim_tempdir))) {
if (vim_tempdir != NULL && !exists) { if (vim_tempdir != NULL) {
notfound++; notfound++;
if (notfound == 1) { if (notfound == 1) {
ELOG("tempdir disappeared (antivirus or broken cleanup job?): %s", vim_tempdir); ELOG("tempdir disappeared (antivirus or broken cleanup job?): %s", vim_tempdir);

View File

@ -1366,9 +1366,7 @@ int recover_names(char *fname, bool do_list, list_T *ret_list, int nr, char **fn
} else if (ret_list != NULL) { } else if (ret_list != NULL) {
for (int i = 0; i < num_files; i++) { for (int i = 0; i < num_files; i++) {
char *name = concat_fnames(dir_name, files[i], true); char *name = concat_fnames(dir_name, files[i], true);
if (name != NULL) { tv_list_append_allocated_string(ret_list, name);
tv_list_append_allocated_string(ret_list, name);
}
} }
} else { } else {
file_count += num_files; file_count += num_files;

View File

@ -3257,8 +3257,7 @@ static void showoptions(bool all, int opt_flags)
} else { } else {
varp = get_varp(p); varp = get_varp(p);
} }
if (varp != NULL if (varp != NULL && (all || !optval_default(p, varp))) {
&& (all == 1 || (all == 0 && !optval_default(p, varp)))) {
int len; int len;
if (opt_flags & OPT_ONECOLUMN) { if (opt_flags & OPT_ONECOLUMN) {
len = Columns; len = Columns;