diff --git a/src/cstdlib.cpp b/src/cstdlib.cpp index bc158edd..76f0319f 100644 --- a/src/cstdlib.cpp +++ b/src/cstdlib.cpp @@ -48,14 +48,12 @@ namespace nowide { #include #include -namespace { -thread_local boost::nowide::stackstring getenv_value; -} - namespace boost { namespace nowide { char* getenv(const char* key) { + thread_local stackstring value; + const wshort_stackstring name(key); static const size_t buf_size = 64; @@ -74,8 +72,8 @@ namespace nowide { return 0; ptr = &tmp[0]; } - getenv_value.convert(ptr); - return getenv_value.get(); + value.convert(ptr); + return value.get(); } int setenv(const char* key, const char* value, int overwrite)