mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 07:29:30 +03:00
merge from dev-win
This commit is contained in:
commit
2b9e3ed01b
1 changed files with 4 additions and 1 deletions
|
@ -209,6 +209,9 @@ static void mi_strlcat(char* dest, const char* src, size_t dest_size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
|
// On Windows use GetEnvironmentVariable instead of getenv to work
|
||||||
|
// reliably even when this is invoked before the C runtime is initialized.
|
||||||
|
// i.e. when `_mi_preloading() == true`.
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
static bool mi_getenv(const char* name, char* result, size_t result_size) {
|
static bool mi_getenv(const char* name, char* result, size_t result_size) {
|
||||||
result[0] = 0;
|
result[0] = 0;
|
||||||
|
@ -241,7 +244,7 @@ static bool mi_getenv(const char* name, char* result, size_t result_size) {
|
||||||
s = getenv(buf);
|
s = getenv(buf);
|
||||||
}
|
}
|
||||||
if (s != NULL && strlen(s) < result_size) {
|
if (s != NULL && strlen(s) < result_size) {
|
||||||
mi_strlcpy(result,s,result_size);
|
mi_strlcpy(result, s, result_size);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue