Avoid using strlen function in loop
This commit is contained in:
parent
60e9d3f69d
commit
c382c72cf2
@ -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…
Reference in New Issue
Block a user