PVS/V1032: pointer cast to a more strictly aligned type

This commit is contained in:
Justin M. Keyes 2019-01-16 00:10:41 +01:00
parent ed171f7be2
commit ea7491586f
4 changed files with 10 additions and 9 deletions

View File

@ -4895,7 +4895,7 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches,
}
}
*matches = (char_u **)"";
*matches = &vim_emptystr;
*num_matches = 0;
int flags = TAG_HELP | TAG_REGEXP | TAG_NAMES | TAG_VERBOSE;
if (keep_lang) {

View File

@ -4702,7 +4702,7 @@ ExpandFromContext (
return ret;
}
*file = (char_u **)"";
*file = &vim_emptystr;
*num_file = 0;
if (xp->xp_context == EXPAND_HELP) {
/* With an empty argument we would get all the help tags, which is

View File

@ -1072,17 +1072,18 @@ EXTERN char_u e_cmdmap_key[] INIT(=N_(
EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
/* For undo we need to know the lowest time possible. */
// For undo we need to know the lowest time possible.
EXTERN time_t starttime;
EXTERN FILE *time_fd INIT(= NULL); /* where to write startup timing */
/*
* Some compilers warn for not using a return value, but in some situations we
* can't do anything useful with the value. Assign to this variable to avoid
* the warning.
*/
// Some compilers warn for not using a return value, but in some situations we
// can't do anything useful with the value. Assign to this variable to avoid
// the warning.
EXTERN int vim_ignored;
// Use this to avoid PVS warning V1032 for code like this:
// *foo = (char_u **)"";
EXTERN char_u *vim_emptystr INIT(= (char_u *)"");
// Start a msgpack-rpc channel over stdin/stdout.
EXTERN bool embedded_mode INIT(= false);

View File

@ -1267,7 +1267,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
}
*num_file = ga.ga_len;
*file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data : (char_u **)"";
*file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data : &vim_emptystr;
recursive = false;