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:
Ian Fan 2018-12-08 22:52:29 +00:00
parent 0c3f0dfd16
commit 19e831ed3d
11 changed files with 39 additions and 55 deletions

View file

@ -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");
}