Simplify the control flow of UsbCommand_ApplyConfig() a bit.
This commit is contained in:
@@ -48,14 +48,12 @@ 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) {
|
||||
continue;
|
||||
if (AllKeymaps[keymapId].abbreviationLen == oldKeymapAbbreviationLen &&
|
||||
!memcmp(oldKeymapAbbreviation, AllKeymaps[keymapId].abbreviation, oldKeymapAbbreviationLen))
|
||||
{
|
||||
SwitchKeymap(keymapId);
|
||||
return;
|
||||
}
|
||||
if (memcmp(oldKeymapAbbreviation, AllKeymaps[keymapId].abbreviation, oldKeymapAbbreviationLen)) {
|
||||
continue;
|
||||
}
|
||||
SwitchKeymap(keymapId);
|
||||
return;
|
||||
}
|
||||
|
||||
SwitchKeymap(DefaultKeymapIndex);
|
||||
|
||||
Reference in New Issue
Block a user