[style] convert to C++11 for loops (#5263)

This commit is contained in:
Simon Lin
2020-07-21 09:41:40 -07:00
committed by GitHub
parent 57ee45be21
commit 5e9b2818eb
31 changed files with 284 additions and 309 deletions
+5 -5
View File
@@ -60,9 +60,9 @@ otError UdpExample::ProcessHelp(uint8_t aArgsLength, char *aArgs[])
OT_UNUSED_VARIABLE(aArgsLength);
OT_UNUSED_VARIABLE(aArgs);
for (size_t i = 0; i < OT_ARRAY_LENGTH(sCommands); i++)
for (const Command &command : sCommands)
{
mInterpreter.mServer->OutputFormat("%s\r\n", sCommands[i].mName);
mInterpreter.mServer->OutputFormat("%s\r\n", command.mName);
}
return OT_ERROR_NONE;
@@ -269,11 +269,11 @@ otError UdpExample::Process(uint8_t aArgsLength, char *aArgs[])
}
else
{
for (size_t i = 0; i < OT_ARRAY_LENGTH(sCommands); i++)
for (const Command &command : sCommands)
{
if (strcmp(aArgs[0], sCommands[i].mName) == 0)
if (strcmp(aArgs[0], command.mName) == 0)
{
error = (this->*sCommands[i].mCommand)(aArgsLength - 1, aArgs + 1);
error = (this->*command.mCommand)(aArgsLength - 1, aArgs + 1);
break;
}
}