aboutsummaryrefslogtreecommitdiff
path: root/swaynag/swaynag.c
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2018-12-08 23:55:14 +0000
committerIan Fan <ianfan0@gmail.com>2018-12-09 01:15:38 +0000
commitc8776fac4232f9faab0a78ef3e18dc4366496421 (patch)
tree028fbc584d233a7a934feb0b6807c9a988c8e7f1 /swaynag/swaynag.c
parent19e831ed3da2aba75d56e46c57967bcc60442d57 (diff)
Cleanup list code
Diffstat (limited to 'swaynag/swaynag.c')
-rw-r--r--swaynag/swaynag.c5
1 files changed, 2 insertions, 3 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);