Settings: Reload desktop keybinds without realloc

This commit is contained in:
Willy-JL
2024-08-24 03:06:31 +02:00
parent d87a45f78d
commit 131416971d
4 changed files with 7 additions and 3 deletions

View File

@@ -109,7 +109,12 @@ static FuriString*
void desktop_keybinds_load(Desktop* desktop, DesktopKeybinds* keybinds) {
for(DesktopKeybindType type = 0; type < DesktopKeybindTypeMAX; type++) {
for(DesktopKeybindKey key = 0; key < DesktopKeybindKeyMAX; key++) {
(*keybinds)[type][key] = furi_string_alloc_set(desktop_keybinds_defaults[type][key]);
const char* default_keybind = desktop_keybinds_defaults[type][key];
if((*keybinds)[type][key]) {
furi_string_set((*keybinds)[type][key], default_keybind);
} else {
(*keybinds)[type][key] = furi_string_alloc_set(default_keybind);
}
}
}