mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
Use static instead of an anonymous namespace.
llvm-svn: 201983
This commit is contained in:
parent
1804845947
commit
900c898665
@ -85,24 +85,22 @@ namespace {
|
||||
|
||||
operator int() const {return FileDescriptor;}
|
||||
};
|
||||
}
|
||||
|
||||
error_code TempDir(SmallVectorImpl<char> &result) {
|
||||
// FIXME: Don't use TMPDIR if program is SUID or SGID enabled.
|
||||
const char *dir = 0;
|
||||
(dir = std::getenv("TMPDIR" )) ||
|
||||
(dir = std::getenv("TMP" )) ||
|
||||
(dir = std::getenv("TEMP" )) ||
|
||||
(dir = std::getenv("TEMPDIR")) ||
|
||||
static error_code TempDir(SmallVectorImpl<char> &result) {
|
||||
// FIXME: Don't use TMPDIR if program is SUID or SGID enabled.
|
||||
const char *dir = 0;
|
||||
(dir = std::getenv("TMPDIR")) || (dir = std::getenv("TMP")) ||
|
||||
(dir = std::getenv("TEMP")) || (dir = std::getenv("TEMPDIR")) ||
|
||||
#ifdef P_tmpdir
|
||||
(dir = P_tmpdir) ||
|
||||
(dir = P_tmpdir) ||
|
||||
#endif
|
||||
(dir = "/tmp");
|
||||
(dir = "/tmp");
|
||||
|
||||
result.clear();
|
||||
StringRef d(dir);
|
||||
result.append(d.begin(), d.end());
|
||||
return error_code::success();
|
||||
}
|
||||
result.clear();
|
||||
StringRef d(dir);
|
||||
result.append(d.begin(), d.end());
|
||||
return error_code::success();
|
||||
}
|
||||
|
||||
static error_code createUniqueEntity(const Twine &Model, int &ResultFD,
|
||||
|
@ -44,31 +44,29 @@ using namespace llvm;
|
||||
using llvm::sys::windows::UTF8ToUTF16;
|
||||
using llvm::sys::windows::UTF16ToUTF8;
|
||||
|
||||
namespace {
|
||||
error_code TempDir(SmallVectorImpl<wchar_t> &result) {
|
||||
retry_temp_dir:
|
||||
DWORD len = ::GetTempPathW(result.capacity(), result.begin());
|
||||
static error_code TempDir(SmallVectorImpl<wchar_t> &result) {
|
||||
retry_temp_dir:
|
||||
DWORD len = ::GetTempPathW(result.capacity(), result.begin());
|
||||
|
||||
if (len == 0)
|
||||
return windows_error(::GetLastError());
|
||||
if (len == 0)
|
||||
return windows_error(::GetLastError());
|
||||
|
||||
if (len > result.capacity()) {
|
||||
result.reserve(len);
|
||||
goto retry_temp_dir;
|
||||
}
|
||||
|
||||
result.set_size(len);
|
||||
return error_code::success();
|
||||
if (len > result.capacity()) {
|
||||
result.reserve(len);
|
||||
goto retry_temp_dir;
|
||||
}
|
||||
|
||||
bool is_separator(const wchar_t value) {
|
||||
switch (value) {
|
||||
case L'\\':
|
||||
case L'/':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
result.set_size(len);
|
||||
return error_code::success();
|
||||
}
|
||||
|
||||
static bool is_separator(const wchar_t value) {
|
||||
switch (value) {
|
||||
case L'\\':
|
||||
case L'/':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user