Skip to content

Commit

Permalink
Revert "Move thread_local variable out of function scope."
Browse files Browse the repository at this point in the history
This reverts commit b596ce2.
  • Loading branch information
Flamefire committed Dec 4, 2024
1 parent b596ce2 commit 7ccee51
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/cstdlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ namespace nowide {
#include <vector>
#include <windows.h>

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;
Expand All @@ -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)
Expand Down

0 comments on commit 7ccee51

Please sign in to comment.