Utils: simplified string list lookup

This commit is contained in:
Stéphane Lepin
2020-09-15 17:12:34 +02:00
parent 2e32b7e299
commit 7f1c4a1c4c

View File

@ -52,15 +52,13 @@ obs_bounds_type getBoundsTypeFromName(QString name) {
} }
bool Utils::StringInStringList(char** strings, const char* string) { bool Utils::StringInStringList(char** strings, const char* string) {
if (!strings) {
return false;
}
size_t index = 0; size_t index = 0;
char* value = nullptr; while (strings[index] != NULL) {
char* value = strings[index];
while (1) {
value = strings[index];
if (value == nullptr) {
return false;
}
if (strcmp(value, string) == 0) { if (strcmp(value, string) == 0) {
return true; return true;
@ -68,6 +66,7 @@ bool Utils::StringInStringList(char** strings, const char* string) {
index++; index++;
} }
return false; return false;
} }