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

@@ -28,9 +28,9 @@ void SwitchKeymapById(uint8_t index)
bool SwitchKeymapByAbbreviation(uint8_t length, char *abbrev)
{
for (uint8_t i=0; i<MAX_KEYMAP_NUM; i++) {
for (uint8_t i=0; i<AllKeymapsCount; i++) {
keymap_reference_t *keymap = AllKeymaps + i;
if (keymap->abbreviationLen == length && strcmp(keymap->abbreviation, abbrev) == 0) {
if (keymap->abbreviationLen == length && memcmp(keymap->abbreviation, abbrev, length) == 0) {
SwitchKeymapById(i);
return true;
}