From 19e831ed3da2aba75d56e46c57967bcc60442d57 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Sat, 8 Dec 2018 22:52:29 +0000 Subject: list.c: Remove list_foreach Most occurrences have been replaced by `free_flat_list` which has been moved from stringop.c to list.c. The rest have been replaced by for loops. --- sway/tree/container.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sway/tree') diff --git a/sway/tree/container.c b/sway/tree/container.c index 91e8dd7f..ac433577 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -21,6 +21,7 @@ #include "sway/tree/arrange.h" #include "sway/tree/view.h" #include "sway/tree/workspace.h" +#include "list.h" #include "log.h" #include "stringop.h" @@ -67,8 +68,7 @@ void container_destroy(struct sway_container *con) { list_free(con->current.children); list_free(con->outputs); - list_foreach(con->marks, free); - list_free(con->marks); + free_flat_list(con->marks); wlr_texture_destroy(con->marks_focused); wlr_texture_destroy(con->marks_focused_inactive); wlr_texture_destroy(con->marks_unfocused); @@ -1267,7 +1267,9 @@ bool container_find_and_unmark(char *mark) { } void container_clear_marks(struct sway_container *con) { - list_foreach(con->marks, free); + for (int i = 0; i < con->marks->length; ++i) { + free(con->marks->items[i]); + } con->marks->length = 0; ipc_event_window(con, "mark"); } -- cgit v1.2.3 From 98c1e19466c0d83c8e1ca86eda5b273eda7eff3c Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Sun, 9 Dec 2018 01:15:23 +0000 Subject: list.c: rename free_flat_list to list_free_items_and_destroy --- sway/tree/container.c | 2 +- sway/tree/workspace.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sway/tree') diff --git a/sway/tree/container.c b/sway/tree/container.c index ac433577..b106e0d9 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -68,7 +68,7 @@ void container_destroy(struct sway_container *con) { list_free(con->current.children); list_free(con->outputs); - free_flat_list(con->marks); + list_free_items_and_destroy(con->marks); wlr_texture_destroy(con->marks_focused); wlr_texture_destroy(con->marks_focused_inactive); wlr_texture_destroy(con->marks_unfocused); diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 4be63311..ed24b4fd 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -142,7 +142,7 @@ void workspace_destroy(struct sway_workspace *workspace) { free(workspace->name); free(workspace->representation); - free_flat_list(workspace->output_priority); + list_free_items_and_destroy(workspace->output_priority); list_free(workspace->floating); list_free(workspace->tiling); list_free(workspace->current.floating); -- cgit v1.2.3