diff options
author | Dan Gohman <gohman@apple.com> | 2010-11-02 22:07:47 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-11-02 22:07:47 +0000 |
commit | 8d4fd965d453053084dcde4b6f900faf39d79a86 (patch) | |
tree | e85dba473e92923d47a839f51ce6e20c5b5c9faa /lib/System/Unix/Path.inc | |
parent | e95c946aebbdf42bc637709bfa6899cf275cbe39 (diff) |
Eliminate some temporary std::strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118086 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix/Path.inc')
-rw-r--r-- | lib/System/Unix/Path.inc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index 254d4de803..15588689f9 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -352,18 +352,18 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) { if (_NSGetExecutablePath(exe_path, &size) == 0) { char link_path[MAXPATHLEN]; if (realpath(exe_path, link_path)) - return Path(std::string(link_path)); + return Path(link_path); } #elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(__minix) char exe_path[PATH_MAX]; if (getprogpath(exe_path, argv0) != NULL) - return Path(std::string(exe_path)); + return Path(exe_path); #elif defined(__linux__) || defined(__CYGWIN__) char exe_path[MAXPATHLEN]; ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path)); if (len >= 0) - return Path(std::string(exe_path, len)); + return Path(StringRef(exe_path, len)); #elif defined(HAVE_DLFCN_H) // Use dladdr to get executable path if available. Dl_info DLInfo; @@ -375,7 +375,7 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) { // the actual executable. char link_path[MAXPATHLEN]; if (realpath(DLInfo.dli_fname, link_path)) - return Path(std::string(link_path)); + return Path(link_path); #else #error GetMainExecutable is not implemented on this host yet. #endif |