From: Rafael Espindola Date: Sun, 23 Feb 2014 15:16:03 +0000 (+0000) Subject: Use static instead of an anonymous namespace. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=da6ffb33d2bf42ff7f10dc1983123ea00f58840f;p=oota-llvm.git Use static instead of an anonymous namespace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201983 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index 83d2b4284a4..e211ac99110 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -85,24 +85,22 @@ namespace { operator int() const {return FileDescriptor;} }; +} - error_code TempDir(SmallVectorImpl &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 &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, diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index f3c7ba1a24d..2e33c129e31 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -44,31 +44,29 @@ using namespace llvm; using llvm::sys::windows::UTF8ToUTF16; using llvm::sys::windows::UTF16ToUTF8; -namespace { - error_code TempDir(SmallVectorImpl &result) { - retry_temp_dir: - DWORD len = ::GetTempPathW(result.capacity(), result.begin()); +static error_code TempDir(SmallVectorImpl &result) { +retry_temp_dir: + DWORD len = ::GetTempPathW(result.capacity(), result.begin()); - if (len == 0) - return windows_error(::GetLastError()); - - if (len > result.capacity()) { - result.reserve(len); - goto retry_temp_dir; - } + if (len == 0) + return windows_error(::GetLastError()); - 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; } }