mirror of
https://github.com/swaywm/sway.git
synced 2024-10-31 21:47:24 +00:00
list.c: rename free_flat_list to list_free_items_and_destroy
This commit is contained in:
parent
c8776fac42
commit
98c1e19466
|
@ -147,7 +147,7 @@ void list_stable_sort(list_t *list, int compare(const void *a, const void *b)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_flat_list(list_t *list) {
|
void list_free_items_and_destroy(list_t *list) {
|
||||||
if (!list) {
|
if (!list) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,8 @@ struct loop *loop_create(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop_destroy(struct loop *loop) {
|
void loop_destroy(struct loop *loop) {
|
||||||
free_flat_list(loop->fd_events);
|
list_free_items_and_destroy(loop->fd_events);
|
||||||
free_flat_list(loop->timers);
|
list_free_items_and_destroy(loop->timers);
|
||||||
free(loop->fds);
|
free(loop->fds);
|
||||||
free(loop);
|
free(loop);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,5 @@ void list_move_to_end(list_t *list, void *item);
|
||||||
* Do not use this to free lists of primitives or items that require more
|
* Do not use this to free lists of primitives or items that require more
|
||||||
* complicated deallocation code.
|
* complicated deallocation code.
|
||||||
*/
|
*/
|
||||||
void free_flat_list(list_t *list);
|
void list_free_items_and_destroy(list_t *list);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,7 +17,7 @@ char *lenient_strncat(char *dest, const char *src, size_t len);
|
||||||
// strcmp that also handles null pointers.
|
// strcmp that also handles null pointers.
|
||||||
int lenient_strcmp(char *a, char *b);
|
int lenient_strcmp(char *a, char *b);
|
||||||
|
|
||||||
// Simply split a string with delims, free with `free_flat_list`
|
// Simply split a string with delims, free with `list_free_items_and_destroy`
|
||||||
list_t *split_string(const char *str, const char *delims);
|
list_t *split_string(const char *str, const char *delims);
|
||||||
|
|
||||||
// Splits an argument string, keeping quotes intact
|
// Splits an argument string, keeping quotes intact
|
||||||
|
|
|
@ -23,11 +23,11 @@ struct cmd_results *bar_cmd_modifier(int argc, char **argv) {
|
||||||
} else {
|
} else {
|
||||||
error = cmd_results_new(CMD_INVALID, "modifier",
|
error = cmd_results_new(CMD_INVALID, "modifier",
|
||||||
"Unknown modifier '%s'", split->items[i]);
|
"Unknown modifier '%s'", split->items[i]);
|
||||||
free_flat_list(split);
|
list_free_items_and_destroy(split);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free_flat_list(split);
|
list_free_items_and_destroy(split);
|
||||||
config->current_bar->modifier = mod;
|
config->current_bar->modifier = mod;
|
||||||
wlr_log(WLR_DEBUG,
|
wlr_log(WLR_DEBUG,
|
||||||
"Show/Hide the bar when pressing '%s' in hide mode.", argv[0]);
|
"Show/Hide the bar when pressing '%s' in hide mode.", argv[0]);
|
||||||
|
|
|
@ -23,7 +23,7 @@ void free_sway_binding(struct sway_binding *binding) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
free_flat_list(binding->keys);
|
list_free_items_and_destroy(binding->keys);
|
||||||
free(binding->input);
|
free(binding->input);
|
||||||
free(binding->command);
|
free(binding->command);
|
||||||
free(binding);
|
free(binding);
|
||||||
|
@ -220,14 +220,14 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
|
||||||
uint32_t *key = calloc(1, sizeof(uint32_t));
|
uint32_t *key = calloc(1, sizeof(uint32_t));
|
||||||
if (!key) {
|
if (!key) {
|
||||||
free_sway_binding(binding);
|
free_sway_binding(binding);
|
||||||
free_flat_list(split);
|
list_free_items_and_destroy(split);
|
||||||
return cmd_results_new(CMD_FAILURE, bindtype,
|
return cmd_results_new(CMD_FAILURE, bindtype,
|
||||||
"Unable to allocate binding key");
|
"Unable to allocate binding key");
|
||||||
}
|
}
|
||||||
*key = key_val;
|
*key = key_val;
|
||||||
list_add(binding->keys, key);
|
list_add(binding->keys, key);
|
||||||
}
|
}
|
||||||
free_flat_list(split);
|
list_free_items_and_destroy(split);
|
||||||
binding->order = binding_order++;
|
binding->order = binding_order++;
|
||||||
|
|
||||||
// refine region of interest for mouse binding once we are certain
|
// refine region of interest for mouse binding once we are certain
|
||||||
|
|
|
@ -24,7 +24,7 @@ static void do_reload(void *data) {
|
||||||
|
|
||||||
if (!load_main_config(config->current_config_path, true, false)) {
|
if (!load_main_config(config->current_config_path, true, false)) {
|
||||||
wlr_log(WLR_ERROR, "Error(s) reloading config");
|
wlr_log(WLR_ERROR, "Error(s) reloading config");
|
||||||
free_flat_list(bar_ids);
|
list_free_items_and_destroy(bar_ids);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ static void do_reload(void *data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free_flat_list(bar_ids);
|
list_free_items_and_destroy(bar_ids);
|
||||||
|
|
||||||
config_update_font_height(true);
|
config_update_font_height(true);
|
||||||
root_for_each_container(rebuild_textures_iterator, NULL);
|
root_for_each_container(rebuild_textures_iterator, NULL);
|
||||||
|
|
|
@ -33,7 +33,7 @@ static struct workspace_config *workspace_config_find_or_create(char *ws_name) {
|
||||||
|
|
||||||
void free_workspace_config(struct workspace_config *wsc) {
|
void free_workspace_config(struct workspace_config *wsc) {
|
||||||
free(wsc->workspace);
|
free(wsc->workspace);
|
||||||
free_flat_list(wsc->outputs);
|
list_free_items_and_destroy(wsc->outputs);
|
||||||
free(wsc);
|
free(wsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -444,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);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -652,7 +652,7 @@ bool read_config(FILE *file, struct sway_config *config,
|
||||||
|
|
||||||
if (read + length > config_size) {
|
if (read + length > config_size) {
|
||||||
wlr_log(WLR_ERROR, "Config file changed during reading");
|
wlr_log(WLR_ERROR, "Config file changed during reading");
|
||||||
free_flat_list(stack);
|
list_free_items_and_destroy(stack);
|
||||||
free(line);
|
free(line);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -681,7 +681,7 @@ bool read_config(FILE *file, struct sway_config *config,
|
||||||
}
|
}
|
||||||
char *expanded = expand_line(block, line, brace_detected > 0);
|
char *expanded = expand_line(block, line, brace_detected > 0);
|
||||||
if (!expanded) {
|
if (!expanded) {
|
||||||
free_flat_list(stack);
|
list_free_items_and_destroy(stack);
|
||||||
free(line);
|
free(line);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -746,7 +746,7 @@ bool read_config(FILE *file, struct sway_config *config,
|
||||||
free(line);
|
free(line);
|
||||||
free_cmd_results(res);
|
free_cmd_results(res);
|
||||||
}
|
}
|
||||||
free_flat_list(stack);
|
list_free_items_and_destroy(stack);
|
||||||
config->current_config_line_number = 0;
|
config->current_config_line_number = 0;
|
||||||
config->current_config_line = NULL;
|
config->current_config_line = NULL;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ void free_bar_config(struct bar_config *bar) {
|
||||||
free_bar_binding(bar->bindings->items[i]);
|
free_bar_binding(bar->bindings->items[i]);
|
||||||
}
|
}
|
||||||
list_free(bar->bindings);
|
list_free(bar->bindings);
|
||||||
free_flat_list(bar->outputs);
|
list_free_items_and_destroy(bar->outputs);
|
||||||
if (bar->pid != 0) {
|
if (bar->pid != 0) {
|
||||||
terminate_swaybar(bar->pid);
|
terminate_swaybar(bar->pid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ void container_destroy(struct sway_container *con) {
|
||||||
list_free(con->current.children);
|
list_free(con->current.children);
|
||||||
list_free(con->outputs);
|
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);
|
||||||
wlr_texture_destroy(con->marks_focused_inactive);
|
wlr_texture_destroy(con->marks_focused_inactive);
|
||||||
wlr_texture_destroy(con->marks_unfocused);
|
wlr_texture_destroy(con->marks_unfocused);
|
||||||
|
|
|
@ -142,7 +142,7 @@ void workspace_destroy(struct sway_workspace *workspace) {
|
||||||
|
|
||||||
free(workspace->name);
|
free(workspace->name);
|
||||||
free(workspace->representation);
|
free(workspace->representation);
|
||||||
free_flat_list(workspace->output_priority);
|
list_free_items_and_destroy(workspace->output_priority);
|
||||||
list_free(workspace->floating);
|
list_free(workspace->floating);
|
||||||
list_free(workspace->tiling);
|
list_free(workspace->tiling);
|
||||||
list_free(workspace->current.floating);
|
list_free(workspace->current.floating);
|
||||||
|
|
Loading…
Reference in a new issue