*/
struct keybind *keybind_create(const char *keybind);
+void keybind_destroy(struct keybind *keybind);
+
/**
* parse_modifier - parse a string containing a single modifier name (e.g. "S")
* into the represented modifier value. returns 0 for invalid modifier names.
wl_list_init(&k->actions);
return k;
}
+
+void
+keybind_destroy(struct keybind *keybind)
+{
+ assert(wl_list_empty(&keybind->actions));
+
+ zfree(keybind->keysyms);
+ zfree(keybind);
+}
if (keybind_the_same(existing, current)) {
wl_list_remove(&existing->link);
action_list_free(&existing->actions);
- free(existing);
+ keybind_destroy(existing);
replaced++;
break;
}
wl_list_for_each_safe(current, tmp, &rc.keybinds, link) {
if (wl_list_empty(¤t->actions)) {
wl_list_remove(¤t->link);
- free(current);
+ keybind_destroy(current);
cleared++;
}
}
wl_list_for_each_safe(k, k_tmp, &rc.keybinds, link) {
wl_list_remove(&k->link);
action_list_free(&k->actions);
- zfree(k->keysyms);
- zfree(k);
+ keybind_destroy(k);
}
struct mousebind *m, *m_tmp;