diff options
Diffstat (limited to 'swaynag')
-rw-r--r-- | swaynag/swaynag.c | 5 | ||||
-rw-r--r-- | swaynag/types.c | 6 |
2 files changed, 4 insertions, 7 deletions
diff --git a/swaynag/swaynag.c b/swaynag/swaynag.c index a2a0b412..e6dfd25f 100644 --- a/swaynag/swaynag.c +++ b/swaynag/swaynag.c @@ -407,9 +407,8 @@ void swaynag_destroy(struct swaynag *swaynag) { swaynag->run_display = false; free(swaynag->message); - while (swaynag->buttons->length) { - struct swaynag_button *button = swaynag->buttons->items[0]; - list_del(swaynag->buttons, 0); + for (int i = 0; i < swaynag->buttons->length; ++i) { + struct swaynag_button *button = swaynag->buttons->items[i]; free(button->text); free(button->action); free(button); diff --git a/swaynag/types.c b/swaynag/types.c index 129644b7..bc17bd33 100644 --- a/swaynag/types.c +++ b/swaynag/types.c @@ -147,10 +147,8 @@ void swaynag_type_free(struct swaynag_type *type) { } void swaynag_types_free(list_t *types) { - while (types->length) { - struct swaynag_type *type = types->items[0]; - swaynag_type_free(type); - list_del(types, 0); + for (int i = 0; i < types->length; ++i) { + swaynag_type_free(types->items[i]); } list_free(types); } |