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

Rework-of: ea7491586f
Helped-by: Björn Linse <bjorn.linse@gmail.com>

- The old (Vim) use of (char_u **)"" before ea7491586f is garbage,
  which hints that this value was never used.
- The necessary condition is next to the NULL assigmnent, the pointer
  would only be started to be accessed, if the length assignment next to
  it is also changed.
This commit is contained in:
Justin M. Keyes 2019-01-17 23:43:43 +01:00
parent ea7491586f
commit aa39fc56f6
4 changed files with 3 additions and 6 deletions

View File

@ -4895,7 +4895,7 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches,
}
}
*matches = &vim_emptystr;
*matches = NULL;
*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 = &vim_emptystr;
*file = NULL;
*num_file = 0;
if (xp->xp_context == EXPAND_HELP) {
/* With an empty argument we would get all the help tags, which is

View File

@ -1081,9 +1081,6 @@ EXTERN FILE *time_fd INIT(= NULL); /* where to write startup timing */
// 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 : &vim_emptystr;
*file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data : NULL;
recursive = false;