[cfe-commits] r135356 - /cfe/trunk/lib/Frontend/InitHeaderSearch.cpp

Francois Pichet pichet2000 at gmail.com
Sat Jul 16 14:17:14 PDT 2011


Author: fpichet
Date: Sat Jul 16 16:17:14 2011
New Revision: 135356

URL: http://llvm.org/viewvc/llvm-project?rev=135356&view=rev
Log:
Do not modify string returned by getenv on Windows. 
Fixes PR9875, patch by Nikola Smiljanic!

Modified:
    cfe/trunk/lib/Frontend/InitHeaderSearch.cpp

Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=135356&r1=135355&r2=135356&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Sat Jul 16 16:17:14 2011
@@ -420,10 +420,8 @@
     vscomntools = vs80comntools;
 
   if (vscomntools && *vscomntools) {
-    char *p = const_cast<char *>(strstr(vscomntools, "\\Common7\\Tools"));
-    if (p)
-      *p = '\0';
-    path = vscomntools;
+    const char *p = strstr(vscomntools, "\\Common7\\Tools");
+    path = p ? std::string(vscomntools, p) : vscomntools;
     return true;
   }
   return false;





More information about the cfe-commits mailing list