From 7ccee51671fb93f20e83e02cedc9dd6fc89c3786 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Wed, 4 Dec 2024 12:43:14 +0100 Subject: [PATCH] Revert "Move thread_local variable out of function scope." This reverts commit b596ce2c4a59c21afae09484c290db5a38e1b687. --- src/cstdlib.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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)