Simplify the control flow of UsbCommand_ApplyConfig() a bit.

This commit is contained in:
László Monda
2017-11-05 22:45:58 +01:00
parent 88514f82f4
commit 97f044d21f

View File

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