mirror of https://github.com/microsoft/mimalloc
fix -Wunused-function for mi_strn-cmp; originally by @rui314 in PR #662 but rebased to dev branch
This commit is contained in:
parent
8c89a77064
commit
2b0421a25c
|
@ -494,13 +494,6 @@ static bool mi_getenv(const char* name, char* result, size_t result_size) {
|
|||
return false;
|
||||
}
|
||||
#else
|
||||
static inline int mi_strnicmp(const char* s, const char* t, size_t n) {
|
||||
if (n==0) return 0;
|
||||
for (; *s != 0 && *t != 0 && n > 0; s++, t++, n--) {
|
||||
if (toupper(*s) != toupper(*t)) break;
|
||||
}
|
||||
return (n==0 ? 0 : *s - *t);
|
||||
}
|
||||
#if defined _WIN32
|
||||
// On Windows use GetEnvironmentVariable instead of getenv to work
|
||||
// reliably even when this is invoked before the C runtime is initialized.
|
||||
|
@ -526,6 +519,13 @@ static char** mi_get_environ(void) {
|
|||
return environ;
|
||||
}
|
||||
#endif
|
||||
static int mi_strnicmp(const char* s, const char* t, size_t n) {
|
||||
if (n == 0) return 0;
|
||||
for (; *s != 0 && *t != 0 && n > 0; s++, t++, n--) {
|
||||
if (toupper(*s) != toupper(*t)) break;
|
||||
}
|
||||
return (n == 0 ? 0 : *s - *t);
|
||||
}
|
||||
static bool mi_getenv(const char* name, char* result, size_t result_size) {
|
||||
if (name==NULL) return false;
|
||||
const size_t len = strlen(name);
|
||||
|
|
Loading…
Reference in New Issue