cleanup: don't hardcode array length

Move the ARRAY_SIZE macro into a header file and use it to determine the
number of cloud servers that we need to check.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2021-04-19 11:37:46 -07:00
parent 9620d11828
commit 194fe28d50
3 changed files with 3 additions and 3 deletions

View file

@ -106,7 +106,7 @@ bool CheckCloudConnection::nextServer()
{ CLOUD_HOST_US, false }
};
const char *server = nullptr;
for (int i = 0; i < CLOUD_NUM_HOSTS; i++) {
for (unsigned int i = 0; i < ARRAY_SIZE(cloudServers); i++) {
if (strstr(prefs.cloud_base_url, cloudServers[i].server))
cloudServers[i].tried = true;
else if (cloudServers[i].tried == false)