diff options
author | 2018-12-09 21:50:19 +1000 | |
---|---|---|
committer | 2018-12-09 21:50:19 +1000 | |
commit | b61a936c8060bc4ac4320a5f76fd98b5042e5e41 (patch) | |
tree | 279a5554686d6e862282c943bda50787b69711e1 /swaynag | |
parent | Merge pull request #3264 from ianyfan/resize-list (diff) | |
parent | list.c: rename free_flat_list to list_free_items_and_destroy (diff) | |
download | sway-b61a936c8060bc4ac4320a5f76fd98b5042e5e41.tar.gz sway-b61a936c8060bc4ac4320a5f76fd98b5042e5e41.tar.zst sway-b61a936c8060bc4ac4320a5f76fd98b5042e5e41.zip |
Merge pull request #3271 from ianyfan/list-cleanup
list.c: Remove list_foreach
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) { | |||
407 | swaynag->run_display = false; | 407 | swaynag->run_display = false; |
408 | 408 | ||
409 | free(swaynag->message); | 409 | free(swaynag->message); |
410 | while (swaynag->buttons->length) { | 410 | for (int i = 0; i < swaynag->buttons->length; ++i) { |
411 | struct swaynag_button *button = swaynag->buttons->items[0]; | 411 | struct swaynag_button *button = swaynag->buttons->items[i]; |
412 | list_del(swaynag->buttons, 0); | ||
413 | free(button->text); | 412 | free(button->text); |
414 | free(button->action); | 413 | free(button->action); |
415 | free(button); | 414 | 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) { | |||
147 | } | 147 | } |
148 | 148 | ||
149 | void swaynag_types_free(list_t *types) { | 149 | void swaynag_types_free(list_t *types) { |
150 | while (types->length) { | 150 | for (int i = 0; i < types->length; ++i) { |
151 | struct swaynag_type *type = types->items[0]; | 151 | swaynag_type_free(types->items[i]); |
152 | swaynag_type_free(type); | ||
153 | list_del(types, 0); | ||
154 | } | 152 | } |
155 | list_free(types); | 153 | list_free(types); |
156 | } | 154 | } |