mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
refactor: apply on expand_shellcmd()
This commit is contained in:
parent
a7187c17b7
commit
5e2075c519
@ -2994,10 +2994,12 @@ static void expand_shellcmd(char *filepat, char ***matches, int *numMatches, int
|
|||||||
bool did_curdir = false;
|
bool did_curdir = false;
|
||||||
|
|
||||||
// for ":set path=" and ":set tags=" halve backslashes for escaped space
|
// for ":set path=" and ":set tags=" halve backslashes for escaped space
|
||||||
char *pat = xstrdup(filepat);
|
size_t filepat_len = strlen(filepat);
|
||||||
|
char *pat = xmemdupz(filepat, filepat_len);
|
||||||
|
char *pat_e = pat + filepat_len;
|
||||||
for (int i = 0; pat[i]; i++) {
|
for (int i = 0; pat[i]; i++) {
|
||||||
if (pat[i] == '\\' && pat[i + 1] == ' ') {
|
if (pat[i] == '\\' && pat[i + 1] == ' ') {
|
||||||
STRMOVE(pat + i, pat + i + 1);
|
memmove(pat + i, pat + i + 1, (size_t)(pat_e - (pat + i + 1) + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user