Centralize freeing of action lists

Reduces some code duplication and makes it easier to extend struct action
This commit is contained in:
Consolatis 2022-01-23 13:46:46 +01:00 committed by ARDiDo
parent 8e9643a855
commit f0a3f365e5
4 changed files with 14 additions and 17 deletions

View file

@ -676,7 +676,6 @@ no_config:
void
rcxml_finish(void)
{
struct action *action, *action_tmp;
zfree(rc.font_name_activewindow);
zfree(rc.font_name_menuitem);
@ -686,11 +685,7 @@ rcxml_finish(void)
struct keybind *k, *k_tmp;
wl_list_for_each_safe(k, k_tmp, &rc.keybinds, link) {
wl_list_remove(&k->link);
wl_list_for_each_safe(action, action_tmp, &k->actions, link) {
wl_list_remove(&action->link);
zfree(action->arg);
zfree(action);
}
action_list_free(&k->actions);
zfree(k->keysyms);
zfree(k);
}
@ -698,11 +693,7 @@ rcxml_finish(void)
struct mousebind *m, *m_tmp;
wl_list_for_each_safe(m, m_tmp, &rc.mousebinds, link) {
wl_list_remove(&m->link);
wl_list_for_each_safe(action, action_tmp, &m->actions, link) {
wl_list_remove(&action->link);
zfree(action->arg);
zfree(action);
}
action_list_free(&m->actions);
zfree(m);
}