Arg list already has program name in it.
authorJeff Cohen <jeffc@jolt-lang.org>
Wed, 16 Feb 2005 04:43:45 +0000 (04:43 +0000)
committerJeff Cohen <jeffc@jolt-lang.org>
Wed, 16 Feb 2005 04:43:45 +0000 (04:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20208 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Win32/Program.inc

index 2d3580d3db35715bd9f6cd3fe8d4bb110882bed9..71d0c2f7c1626e9a858d3e1d624ffe5a3c7ade22 100644 (file)
@@ -81,11 +81,7 @@ Program::ExecuteAndWait(const Path& path,
   // have embedded spaces.
 
   // First, determine the length of the command line.
-  std::string progname(path.getLast());
-  unsigned len = progname.length() + 1;
-  if (progname.find(' ') != std::string::npos)
-    len += 2;
-
+  unsigned len = 0;
   for (unsigned i = 0; args[i]; i++) {
     len += strlen(args[i]) + 1;
     if (strchr(args[i], ' '))
@@ -96,19 +92,10 @@ Program::ExecuteAndWait(const Path& path,
   char *command = reinterpret_cast<char *>(_alloca(len));
   char *p = command;
 
-  bool needsQuoting = progname.find(' ') != std::string::npos;
-  if (needsQuoting)
-    *p++ = '"';
-  memcpy(p, progname.c_str(), progname.length());
-  p += progname.length();
-  if (needsQuoting)
-    *p++ = '"';
-  *p++ = ' ';
-
   for (unsigned i = 0; args[i]; i++) {
     const char *arg = args[i];
        size_t len = strlen(arg);
-    needsQuoting = strchr(arg, ' ') != 0;
+    bool needsQuoting = strchr(arg, ' ') != 0;
     if (needsQuoting)
       *p++ = '"';
     memcpy(p, arg, len);