mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-20 22:19:30 +03:00
Fix -Wunused-function
`mi_strnicmp` is defined but not used If `MI_USE_ENVIRON` is not set, which triggers a `-Wunused-function` warning. Since the function is used only by `mi_getenv`, we can move the `mi_strnicmp` just before `mi_getenv` to fix the warning.
This commit is contained in:
parent
c7d4a099d9
commit
a96a5c89c1
1 changed files with 14 additions and 15 deletions
|
@ -479,15 +479,7 @@ static bool mi_getenv(const char* name, char* result, size_t result_size) {
|
||||||
MI_UNUSED(result_size);
|
MI_UNUSED(result_size);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#elif defined _WIN32
|
||||||
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
|
// On Windows use GetEnvironmentVariable instead of getenv to work
|
||||||
// reliably even when this is invoked before the C runtime is initialized.
|
// reliably even when this is invoked before the C runtime is initialized.
|
||||||
// i.e. when `_mi_preloading() == true`.
|
// i.e. when `_mi_preloading() == true`.
|
||||||
|
@ -512,6 +504,14 @@ static char** mi_get_environ(void) {
|
||||||
return environ;
|
return environ;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
if (name==NULL) return false;
|
if (name==NULL) return false;
|
||||||
const size_t len = strlen(name);
|
const size_t len = strlen(name);
|
||||||
|
@ -554,7 +554,6 @@ static bool mi_getenv(const char* name, char* result, size_t result_size) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // !MI_USE_ENVIRON
|
|
||||||
#endif // !MI_NO_GETENV
|
#endif // !MI_NO_GETENV
|
||||||
|
|
||||||
static void mi_option_init(mi_option_desc_t* desc) {
|
static void mi_option_init(mi_option_desc_t* desc) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue