mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #4631 from KillTheMule/vim-7.4.871
vim-patch:7.4.871
This commit is contained in:
commit
17294977bd
@ -1926,7 +1926,7 @@ int expand_wildcards_eval(char_u **pat, int *num_file, char_u ***file,
|
|||||||
/// If FAIL is returned, *num_file and *file are either
|
/// If FAIL is returned, *num_file and *file are either
|
||||||
/// unchanged or *num_file is set to 0 and *file is set to
|
/// unchanged or *num_file is set to 0 and *file is set to
|
||||||
/// NULL or points to "".
|
/// NULL or points to "".
|
||||||
int expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file,
|
int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
@ -1934,7 +1934,7 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file,
|
|||||||
char_u *p;
|
char_u *p;
|
||||||
int non_suf_match; /* number without matching suffix */
|
int non_suf_match; /* number without matching suffix */
|
||||||
|
|
||||||
retval = gen_expand_wildcards(num_pat, pat, num_file, file, flags);
|
retval = gen_expand_wildcards(num_pat, pat, num_files, files, flags);
|
||||||
|
|
||||||
/* When keeping all matches, return here */
|
/* When keeping all matches, return here */
|
||||||
if ((flags & EW_KEEPALL) || retval == FAIL)
|
if ((flags & EW_KEEPALL) || retval == FAIL)
|
||||||
@ -1946,18 +1946,20 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file,
|
|||||||
if (*p_wig) {
|
if (*p_wig) {
|
||||||
char_u *ffname;
|
char_u *ffname;
|
||||||
|
|
||||||
/* check all files in (*file)[] */
|
// check all filess in (*files)[]
|
||||||
for (i = 0; i < *num_file; ++i) {
|
for (i = 0; i < *num_files; i++) {
|
||||||
ffname = (char_u *)FullName_save((char *)(*file)[i], FALSE);
|
ffname = (char_u *)FullName_save((char *)(*files)[i], false);
|
||||||
if (ffname == NULL) /* out of memory */
|
if (ffname == NULL) { // out of memory
|
||||||
break;
|
break;
|
||||||
if (match_file_list(p_wig, (*file)[i], ffname)) {
|
}
|
||||||
/* remove this matching file from the list */
|
if (match_file_list(p_wig, (*files)[i], ffname)) {
|
||||||
xfree((*file)[i]);
|
// remove this matching files from the list
|
||||||
for (j = i; j + 1 < *num_file; ++j)
|
xfree((*files)[i]);
|
||||||
(*file)[j] = (*file)[j + 1];
|
for (j = i; j + 1 < *num_files; j++) {
|
||||||
--*num_file;
|
(*files)[j] = (*files)[j + 1];
|
||||||
--i;
|
}
|
||||||
|
(*num_files)--;
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
xfree(ffname);
|
xfree(ffname);
|
||||||
}
|
}
|
||||||
@ -1966,26 +1968,28 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file,
|
|||||||
/*
|
/*
|
||||||
* Move the names where 'suffixes' match to the end.
|
* Move the names where 'suffixes' match to the end.
|
||||||
*/
|
*/
|
||||||
if (*num_file > 1) {
|
if (*num_files > 1) {
|
||||||
non_suf_match = 0;
|
non_suf_match = 0;
|
||||||
for (i = 0; i < *num_file; ++i) {
|
for (i = 0; i < *num_files; i++) {
|
||||||
if (!match_suffix((*file)[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 = (*file)[i];
|
p = (*files)[i];
|
||||||
for (j = i; j > non_suf_match; --j)
|
for (j = i; j > non_suf_match; j--) {
|
||||||
(*file)[j] = (*file)[j - 1];
|
(*files)[j] = (*files)[j - 1];
|
||||||
(*file)[non_suf_match++] = p;
|
}
|
||||||
|
(*files)[non_suf_match++] = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free empty array of matches
|
// Free empty array of matches
|
||||||
if (*num_file == 0) {
|
if (*num_files == 0) {
|
||||||
xfree(*file);
|
xfree(*files);
|
||||||
*file = NULL;
|
*files = NULL;
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
Loading…
Reference in New Issue
Block a user