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

This commit is contained in:
Simon Lin
2020-07-22 00:41:40 +08:00
committed by GitHub
parent 57ee45be21
commit 5e9b2818eb
31 changed files with 284 additions and 309 deletions
+5 -5
View File
@@ -192,11 +192,11 @@ otError Dataset::Process(uint8_t aArgsLength, char *aArgs[])
ExitNow(error = Print(sDataset));
}
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;
}
}
@@ -210,9 +210,9 @@ otError Dataset::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;