1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-24 23:19:09 +00:00

Codechange: use the C++ std::getenv over the POSIX/C getenv

The C++ std::getenv is guaranteed thread-safe by the C++11 specification,
whereas the POSIX/C getenv might not be thread-safe by the C11 specification.
This commit is contained in:
Rubidium
2021-07-10 22:32:35 +02:00
committed by rubidium42
parent d158eba72c
commit 3e4d327451
2 changed files with 7 additions and 7 deletions

View File

@@ -1850,18 +1850,18 @@ const char *GetCurrentLocale(const char *param)
{
const char *env;
env = getenv("LANGUAGE");
env = std::getenv("LANGUAGE");
if (env != nullptr) return env;
env = getenv("LC_ALL");
env = std::getenv("LC_ALL");
if (env != nullptr) return env;
if (param != nullptr) {
env = getenv(param);
env = std::getenv(param);
if (env != nullptr) return env;
}
return getenv("LANG");
return std::getenv("LANG");
}
#else
const char *GetCurrentLocale(const char *param);