mirror of
https://github.com/swaywm/sway.git
synced 2025-11-17 06:59:48 -05:00
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.
This commit is contained in:
parent
0c3f0dfd16
commit
19e831ed3d
11 changed files with 39 additions and 55 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue