[llvm-commits] [llvm] r101723 - /llvm/trunk/lib/System/Unix/Program.inc
Chris Lattner
sabre at nondot.org
Sun Apr 18 10:34:10 PDT 2010
Author: lattner
Date: Sun Apr 18 12:34:10 2010
New Revision: 101723
URL: http://llvm.org/viewvc/llvm-project?rev=101723&view=rev
Log:
avoid temporary std::string in non posix_spawn path.
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=101723&r1=101722&r2=101723&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Program.inc (original)
+++ llvm/trunk/lib/System/Unix/Program.inc Sun Apr 18 12:34:10 2010
@@ -104,17 +104,17 @@
static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) {
if (Path == 0) // Noop
return false;
- std::string File;
+ const char *File;
if (Path->isEmpty())
// Redirect empty paths to /dev/null
File = "/dev/null";
else
- File = Path->str();
+ File = Path->c_str();
// Open the file
- int InFD = open(File.c_str(), FD == 0 ? O_RDONLY : O_WRONLY|O_CREAT, 0666);
+ int InFD = open(File, FD == 0 ? O_RDONLY : O_WRONLY|O_CREAT, 0666);
if (InFD == -1) {
- MakeErrMsg(ErrMsg, "Cannot open file '" + File + "' for "
+ MakeErrMsg(ErrMsg, "Cannot open file '" + std::string(File) + "' for "
+ (FD == 0 ? "input" : "output"));
return true;
}
More information about the llvm-commits
mailing list