[llvm-commits] [llvm] r101782 - /llvm/trunk/lib/System/Unix/Program.inc

Dan Gohman gohman at apple.com
Mon Apr 19 08:55:10 PDT 2010


Author: djg
Date: Mon Apr 19 10:55:10 2010
New Revision: 101782

URL: http://llvm.org/viewvc/llvm-project?rev=101782&view=rev
Log:
Fix -Wcast-qual warnings.

Modified:
    llvm/trunk/lib/System/Unix/Program.inc

Modified: llvm/trunk/lib/System/Unix/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=101782&r1=101781&r2=101782&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Program.inc (original)
+++ llvm/trunk/lib/System/Unix/Program.inc Mon Apr 19 10:55:10 2010
@@ -206,14 +206,15 @@
 
     if (!envp)
 #if !defined(__APPLE__)
-      envp = (const char**)environ;
+      envp = const_cast<const char **>(environ);
 #else
-      envp = (const char**)*_NSGetEnviron(); // environ is missing in dylibs.
+      // environ is missing in dylibs.
+      envp = const_cast<const char **>(*_NSGetEnviron());
 #endif
 
     pid_t PID;
-    int Err = posix_spawn(&PID, path.c_str(), &FileActions,
-                          /*attrp*/0, (char**)args, (char**)envp);
+    int Err = posix_spawn(&PID, path.c_str(), &FileActions, /*attrp*/0,
+                          const_cast<char **>(args), const_cast<char **>(envp));
                           
     posix_spawn_file_actions_destroy(&FileActions);
 
@@ -268,9 +269,12 @@
 
       // Execute!
       if (envp != 0)
-        execve(path.c_str(), (char**)args, (char**)envp);
+        execve(path.c_str(),
+               const_cast<char **>(args),
+               const_cast<char **>(envp));
       else
-        execv(path.c_str(), (char**)args);
+        execv(path.c_str(),
+              const_cast<char **>(args));
       // If the execve() failed, we should exit. Follow Unix protocol and
       // return 127 if the executable was not found, and 126 otherwise.
       // Use _exit rather than exit so that atexit functions and static





More information about the llvm-commits mailing list