1
0
forked from aniani/vim

patch 8.0.1745: build failure on MS-Windows

Problem:    Build failure on MS-Windows.
Solution:   Build job arguments for MS-Windows. Fix allocating job twice.
This commit is contained in:
Bram Moolenaar
2018-04-21 22:30:08 +02:00
parent 9980b37a80
commit 2060892028
7 changed files with 121 additions and 123 deletions

View File

@@ -4154,91 +4154,6 @@ wait4pid(pid_t child, waitstatus *status)
return wait_pid;
}
#if defined(FEAT_JOB_CHANNEL) \
|| !defined(USE_SYSTEM) \
|| (defined(FEAT_GUI) && defined(FEAT_TERMINAL)) \
|| defined(PROTO)
/*
* Parse "cmd" and put the white-separated parts in "argv".
* "argv" is an allocated array with "argc" entries and room for 4 more.
* Returns FAIL when out of memory.
*/
int
mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
{
int i;
char_u *p, *d;
int inquote;
/*
* Do this loop twice:
* 1: find number of arguments
* 2: separate them and build argv[]
*/
for (i = 0; i < 2; ++i)
{
p = skipwhite(cmd);
inquote = FALSE;
*argc = 0;
for (;;)
{
if (i == 1)
(*argv)[*argc] = (char *)p;
++*argc;
d = p;
while (*p != NUL && (inquote || (*p != ' ' && *p != TAB)))
{
if (p[0] == '"')
/* quotes surrounding an argument and are dropped */
inquote = !inquote;
else
{
if (p[0] == '\\' && p[1] != NUL)
{
/* First pass: skip over "\ " and "\"".
* Second pass: Remove the backslash. */
++p;
}
if (i == 1)
*d++ = *p;
}
++p;
}
if (*p == NUL)
{
if (i == 1)
*d++ = NUL;
break;
}
if (i == 1)
*d++ = NUL;
p = skipwhite(p + 1);
}
if (*argv == NULL)
{
if (use_shcf)
{
/* Account for possible multiple args in p_shcf. */
p = p_shcf;
for (;;)
{
p = skiptowhite(p);
if (*p == NUL)
break;
++*argc;
p = skipwhite(p);
}
}
*argv = (char **)alloc((unsigned)((*argc + 4) * sizeof(char *)));
if (*argv == NULL) /* out of memory */
return FAIL;
}
}
return OK;
}
#endif
#if !defined(USE_SYSTEM) || defined(FEAT_JOB_CHANNEL)
/*
* Set the environment for a child process.