mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-04 22:49:32 +03:00
Avoid using strlen function in loop
This commit is contained in:
parent
60e9d3f69d
commit
c382c72cf2
1 changed files with 4 additions and 2 deletions
|
@ -176,7 +176,8 @@ static void mi_option_init(mi_option_desc_t* desc) {
|
|||
#pragma warning(suppress:4996)
|
||||
char* s = getenv(buf);
|
||||
if (s == NULL) {
|
||||
for (size_t i = 0; i < strlen(buf); i++) {
|
||||
size_t buf_size = strlen(buf);
|
||||
for (size_t i = 0; i < buf_size; i++) {
|
||||
buf[i] = toupper(buf[i]);
|
||||
}
|
||||
#pragma warning(suppress:4996)
|
||||
|
@ -184,7 +185,8 @@ static void mi_option_init(mi_option_desc_t* desc) {
|
|||
}
|
||||
if (s != NULL) {
|
||||
mi_strlcpy(buf, s, sizeof(buf));
|
||||
for (size_t i = 0; i < strlen(buf); i++) {
|
||||
size_t buf_size = strlen(buf); // TODO: use strnlen?
|
||||
for (size_t i = 0; i < buf_size; i++) {
|
||||
buf[i] = toupper(buf[i]);
|
||||
}
|
||||
if (buf[0]==0 || strstr("1;TRUE;YES;ON", buf) != NULL) {
|
||||
|
|
Loading…
Add table
Reference in a new issue