aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/commands/bind.c4
-rw-r--r--sway/commands/reload.c7
-rw-r--r--sway/config.c9
-rw-r--r--sway/config/bar.c4
-rw-r--r--sway/tree/container.c8
5 files changed, 12 insertions, 20 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c
index c8b634b9..52a245fa 100644
--- a/sway/commands/bind.c
+++ b/sway/commands/bind.c
@@ -23,9 +23,7 @@ void free_sway_binding(struct sway_binding *binding) {
return;
}
- if (binding->keys) {
- free_flat_list(binding->keys);
- }
+ free_flat_list(binding->keys);
free(binding->input);
free(binding->command);
free(binding);
diff --git a/sway/commands/reload.c b/sway/commands/reload.c
index c64de4bd..c236911e 100644
--- a/sway/commands/reload.c
+++ b/sway/commands/reload.c
@@ -24,8 +24,7 @@ static void do_reload(void *data) {
if (!load_main_config(config->current_config_path, true, false)) {
wlr_log(WLR_ERROR, "Error(s) reloading config");
- list_foreach(bar_ids, free);
- list_free(bar_ids);
+ free_flat_list(bar_ids);
return;
}
@@ -42,9 +41,7 @@ static void do_reload(void *data) {
}
}
}
-
- list_foreach(bar_ids, free);
- list_free(bar_ids);
+ free_flat_list(bar_ids);
config_update_font_height(true);
root_for_each_container(rebuild_textures_iterator, NULL);
diff --git a/sway/config.c b/sway/config.c
index ff7de4b9..efb95e31 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -654,8 +654,7 @@ bool read_config(FILE *file, struct sway_config *config,
if (read + length > config_size) {
wlr_log(WLR_ERROR, "Config file changed during reading");
- list_foreach(stack, free);
- list_free(stack);
+ free_flat_list(stack);
free(line);
return false;
}
@@ -684,8 +683,7 @@ bool read_config(FILE *file, struct sway_config *config,
}
char *expanded = expand_line(block, line, brace_detected > 0);
if (!expanded) {
- list_foreach(stack, free);
- list_free(stack);
+ free_flat_list(stack);
free(line);
return false;
}
@@ -750,8 +748,7 @@ bool read_config(FILE *file, struct sway_config *config,
free(line);
free_cmd_results(res);
}
- list_foreach(stack, free);
- list_free(stack);
+ free_flat_list(stack);
config->current_config_line_number = 0;
config->current_config_line = NULL;
diff --git a/sway/config/bar.c b/sway/config/bar.c
index 36e10527..82457ef4 100644
--- a/sway/config/bar.c
+++ b/sway/config/bar.c
@@ -53,9 +53,7 @@ void free_bar_config(struct bar_config *bar) {
free_bar_binding(binding);
}
list_free(bar->bindings);
- if (bar->outputs) {
- free_flat_list(bar->outputs);
- }
+ free_flat_list(bar->outputs);
if (bar->pid != 0) {
terminate_swaybar(bar->pid);
}
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");
}