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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user