struct KeymapList *NewKeymaps[MENU_MAX];
static void mutt_keymap_free(struct Keymap **km);
+static void mutt_keymaplist_free(struct Keymap **km_list);
/**
* alloc_keys - Allocate space for a sequence of keys
*/
void mutt_keys_free(void)
{
- struct Keymap *map = NULL;
- struct Keymap *next = NULL;
-
for (int i = 0; i < MENU_MAX; i++)
{
- for (map = Keymaps[i]; map; map = next)
- {
- next = map->next;
- mutt_keymap_free(&map);
- }
-
- Keymaps[i] = NULL;
+ mutt_keymaplist_free(&Keymaps[i]);
}
}
-
/**
* mutt_keymap_free - Free a Keymap
* @param km Keymap to free
FREE(&(*km)->keys);
FREE(km);
}
+
+/**
+ * mutt_keymaplist_free - Free a List of Keymaps
+ * @param km_list List of Keymaps to free
+ */
+static void mutt_keymaplist_free(struct Keymap **km_list)
+{
+ struct Keymap *map = NULL;
+ struct Keymap *next = NULL;
+ for (map = (*km_list); map; map = next)
+ {
+ next = map->next;
+ mutt_keymap_free(&map);
+ }
+ *km_list = NULL;
+}