diff options
author | Rubidium <rubidium@openttd.org> | 2021-07-10 22:32:35 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-07-10 22:55:46 +0200 |
commit | 3e4d3274517d6a5f3fede18e0e29eafcdc30d0c8 (patch) | |
tree | 93524cd39d22bd38a14d30f22ead746022b175e5 /src/strings.cpp | |
parent | d158eba72c89ae580c55a8421d470528de7637f5 (diff) | |
download | openttd-3e4d3274517d6a5f3fede18e0e29eafcdc30d0c8.tar.xz |
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.
Diffstat (limited to 'src/strings.cpp')
-rw-r--r-- | src/strings.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index 423e2ebf0..7ff1cee31 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -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); |