aboutsummaryrefslogtreecommitdiff
path: root/sway/config.c
diff options
context:
space:
mode:
authorRyan Dwyer <RyanDwyer@users.noreply.github.com>2018-12-09 21:50:19 +1000
committerGitHub <noreply@github.com>2018-12-09 21:50:19 +1000
commitb61a936c8060bc4ac4320a5f76fd98b5042e5e41 (patch)
tree279a5554686d6e862282c943bda50787b69711e1 /sway/config.c
parente7efa0e27b7bf44217d7f147281d463708d2dfc9 (diff)
parent98c1e19466c0d83c8e1ca86eda5b273eda7eff3c (diff)
downloadsway-b61a936c8060bc4ac4320a5f76fd98b5042e5e41.tar.xz
Merge pull request #3271 from ianyfan/list-cleanup
list.c: Remove list_foreach
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sway/config.c b/sway/config.c
index ff7de4b9..5b03bc56 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -38,26 +38,24 @@
struct sway_config *config = NULL;
static void free_mode(struct sway_mode *mode) {
- int i;
-
if (!mode) {
return;
}
free(mode->name);
if (mode->keysym_bindings) {
- for (i = 0; i < mode->keysym_bindings->length; i++) {
+ for (int i = 0; i < mode->keysym_bindings->length; i++) {
free_sway_binding(mode->keysym_bindings->items[i]);
}
list_free(mode->keysym_bindings);
}
if (mode->keycode_bindings) {
- for (i = 0; i < mode->keycode_bindings->length; i++) {
+ for (int i = 0; i < mode->keycode_bindings->length; i++) {
free_sway_binding(mode->keycode_bindings->items[i]);
}
list_free(mode->keycode_bindings);
}
if (mode->mouse_bindings) {
- for (i = 0; i < mode->mouse_bindings->length; i++) {
+ for (int i = 0; i < mode->mouse_bindings->length; i++) {
free_sway_binding(mode->mouse_bindings->items[i]);
}
list_free(mode->mouse_bindings);
@@ -446,7 +444,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
}
}
- free_flat_list(secconfigs);
+ list_free_items_and_destroy(secconfigs);
}
*/
@@ -654,8 +652,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);
+ list_free_items_and_destroy(stack);
free(line);
return false;
}
@@ -684,8 +681,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);
+ list_free_items_and_destroy(stack);
free(line);
return false;
}
@@ -750,8 +746,7 @@ bool read_config(FILE *file, struct sway_config *config,
free(line);
free_cmd_results(res);
}
- list_foreach(stack, free);
- list_free(stack);
+ list_free_items_and_destroy(stack);
config->current_config_line_number = 0;
config->current_config_line = NULL;