Fix SwitchKeymapByAbbreviation() and use it in place of a for block of equivalent functionality within UsbCommand_ApplyConfig()

This commit is contained in:
László Monda
2018-04-10 21:27:56 +02:00
parent 1e61a39210
commit 7002e7de52
2 changed files with 4 additions and 10 deletions

View File

@@ -45,14 +45,8 @@ void UsbCommand_ApplyConfig(void)
}
// Switch to the keymap of the updated configuration of the same name or the default keymap.
for (uint8_t keymapId = 0; keymapId < AllKeymapsCount; keymapId++) {
if (AllKeymaps[keymapId].abbreviationLen == oldKeymapAbbreviationLen &&
!memcmp(oldKeymapAbbreviation, AllKeymaps[keymapId].abbreviation, oldKeymapAbbreviationLen))
{
SwitchKeymapById(keymapId);
return;
}
if (SwitchKeymapByAbbreviation(oldKeymapAbbreviationLen, oldKeymapAbbreviation)) {
return;
}
SwitchKeymapById(DefaultKeymapIndex);