[llvm-commits] CVS: llvm/lib/System/Win32/Program.inc

Jeff Cohen jeffc at jolt-lang.org
Tue Feb 15 20:43:55 PST 2005



Changes in directory llvm/lib/System/Win32:

Program.inc updated: 1.9 -> 1.10
---
Log message:

Arg list already has program name in it.

---
Diffs of the changes:  (+2 -15)

 Program.inc |   17 ++---------------
 1 files changed, 2 insertions(+), 15 deletions(-)


Index: llvm/lib/System/Win32/Program.inc
diff -u llvm/lib/System/Win32/Program.inc:1.9 llvm/lib/System/Win32/Program.inc:1.10
--- llvm/lib/System/Win32/Program.inc:1.9	Sun Dec 19 21:24:56 2004
+++ llvm/lib/System/Win32/Program.inc	Tue Feb 15 22:43:45 2005
@@ -81,11 +81,7 @@
   // 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 @@
   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);






More information about the llvm-commits mailing list