mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
clang/"null pointer dereference": expand_wildcards
This invariant is explained in aa39fc56f6
.
This commit is contained in:
parent
8f9fc1f692
commit
6cd3912a51
@ -2039,6 +2039,7 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files,
|
|||||||
char_u *ffname;
|
char_u *ffname;
|
||||||
|
|
||||||
// check all files in (*files)[]
|
// check all files in (*files)[]
|
||||||
|
assert(*num_files == 0 || *files != NULL);
|
||||||
for (i = 0; i < *num_files; i++) {
|
for (i = 0; i < *num_files; i++) {
|
||||||
ffname = (char_u *)FullName_save((char *)(*files)[i], false);
|
ffname = (char_u *)FullName_save((char *)(*files)[i], false);
|
||||||
assert((*files)[i] != NULL);
|
assert((*files)[i] != NULL);
|
||||||
@ -2056,16 +2057,16 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
//
|
||||||
* Move the names where 'suffixes' match to the end.
|
// Move the names where 'suffixes' match to the end.
|
||||||
*/
|
//
|
||||||
|
assert(*num_files == 0 || *files != NULL);
|
||||||
if (*num_files > 1) {
|
if (*num_files > 1) {
|
||||||
non_suf_match = 0;
|
non_suf_match = 0;
|
||||||
for (i = 0; i < *num_files; i++) {
|
for (i = 0; i < *num_files; i++) {
|
||||||
if (!match_suffix((*files)[i])) {
|
if (!match_suffix((*files)[i])) {
|
||||||
//
|
//
|
||||||
// Move the name without matching suffix to the front
|
// Move the name without matching suffix to the front of the list.
|
||||||
// of the list.
|
|
||||||
//
|
//
|
||||||
p = (*files)[i];
|
p = (*files)[i];
|
||||||
for (j = i; j > non_suf_match; j--) {
|
for (j = i; j > non_suf_match; j--) {
|
||||||
|
Loading…
Reference in New Issue
Block a user