mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
config: config_free(): pass conf struct by pointer, not by-value
This commit is contained in:
parent
06d7432af3
commit
99db7aa7cf
5 changed files with 49 additions and 49 deletions
52
config.c
52
config.c
|
|
@ -3172,8 +3172,8 @@ UNITTEST
|
|||
xassert(clone != NULL);
|
||||
xassert(clone != &original);
|
||||
|
||||
config_free(original);
|
||||
config_free(*clone);
|
||||
config_free(&original);
|
||||
config_free(clone);
|
||||
free(clone);
|
||||
|
||||
tll_free(overrides);
|
||||
|
|
@ -3181,35 +3181,35 @@ UNITTEST
|
|||
}
|
||||
|
||||
void
|
||||
config_free(struct config conf)
|
||||
config_free(struct config *conf)
|
||||
{
|
||||
free(conf.term);
|
||||
free(conf.shell);
|
||||
free(conf.title);
|
||||
free(conf.app_id);
|
||||
free(conf.word_delimiters);
|
||||
spawn_template_free(&conf.bell.command);
|
||||
free(conf.scrollback.indicator.text);
|
||||
spawn_template_free(&conf.notify);
|
||||
for (size_t i = 0; i < ALEN(conf.fonts); i++)
|
||||
config_font_list_destroy(&conf.fonts[i]);
|
||||
free(conf.server_socket_path);
|
||||
free(conf->term);
|
||||
free(conf->shell);
|
||||
free(conf->title);
|
||||
free(conf->app_id);
|
||||
free(conf->word_delimiters);
|
||||
spawn_template_free(&conf->bell.command);
|
||||
free(conf->scrollback.indicator.text);
|
||||
spawn_template_free(&conf->notify);
|
||||
for (size_t i = 0; i < ALEN(conf->fonts); i++)
|
||||
config_font_list_destroy(&conf->fonts[i]);
|
||||
free(conf->server_socket_path);
|
||||
|
||||
config_font_list_destroy(&conf.csd.font);
|
||||
config_font_list_destroy(&conf->csd.font);
|
||||
|
||||
free(conf.url.label_letters);
|
||||
spawn_template_free(&conf.url.launch);
|
||||
for (size_t i = 0; i < conf.url.prot_count; i++)
|
||||
free(conf.url.protocols[i]);
|
||||
free(conf.url.protocols);
|
||||
free(conf.url.uri_characters);
|
||||
free(conf->url.label_letters);
|
||||
spawn_template_free(&conf->url.launch);
|
||||
for (size_t i = 0; i < conf->url.prot_count; i++)
|
||||
free(conf->url.protocols[i]);
|
||||
free(conf->url.protocols);
|
||||
free(conf->url.uri_characters);
|
||||
|
||||
free_key_binding_list(&conf.bindings.key);
|
||||
free_key_binding_list(&conf.bindings.search);
|
||||
free_key_binding_list(&conf.bindings.url);
|
||||
free_key_binding_list(&conf.bindings.mouse);
|
||||
free_key_binding_list(&conf->bindings.key);
|
||||
free_key_binding_list(&conf->bindings.search);
|
||||
free_key_binding_list(&conf->bindings.url);
|
||||
free_key_binding_list(&conf->bindings.mouse);
|
||||
|
||||
user_notifications_free(&conf.notifications);
|
||||
user_notifications_free(&conf->notifications);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
2
config.h
2
config.h
|
|
@ -328,7 +328,7 @@ bool config_load(
|
|||
struct config *conf, const char *path,
|
||||
user_notifications_t *initial_user_notifications,
|
||||
config_override_t *overrides, bool errors_are_fatal);
|
||||
void config_free(struct config conf);
|
||||
void config_free(struct config *conf);
|
||||
struct config *config_clone(const struct config *old);
|
||||
|
||||
bool config_font_parse(const char *pattern, struct config_font *font);
|
||||
|
|
|
|||
6
main.c
6
main.c
|
|
@ -485,12 +485,12 @@ main(int argc, char *const *argv)
|
|||
|
||||
tll_free(overrides);
|
||||
if (!conf_successful) {
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (check_config) {
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -663,7 +663,7 @@ out:
|
|||
fdm_signal_del(fdm, SIGINT);
|
||||
fdm_destroy(fdm);
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
|
||||
if (unlink_pid_file)
|
||||
unlink(pid_file);
|
||||
|
|
|
|||
2
server.c
2
server.c
|
|
@ -122,7 +122,7 @@ instance_destroy(struct terminal_instance *instance, int exit_code)
|
|||
/* TODO: clone server conf completely, so that we can just call
|
||||
* conf_destroy() here */
|
||||
if (instance->conf != NULL) {
|
||||
config_free(*instance->conf);
|
||||
config_free(instance->conf);
|
||||
free(instance->conf);
|
||||
}
|
||||
free(instance);
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ test_section_main(void)
|
|||
/* TODO: initial-window-size-pixels (geometry) */
|
||||
/* TODO: initial-window-size-chars (geometry) */
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -482,7 +482,7 @@ test_section_bell(void)
|
|||
test_spawn_template(&ctx, &parse_section_bell, "command",
|
||||
&conf.bell.command);
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -509,7 +509,7 @@ test_section_scrollback(void)
|
|||
|
||||
/* TODO: indicator-format (enum, sort-of) */
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -532,7 +532,7 @@ test_section_url(void)
|
|||
/* TODO: protocols (list of wchars) */
|
||||
/* TODO: uri-characters (wchar string, but sorted) */
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -558,7 +558,7 @@ test_section_cursor(void)
|
|||
|
||||
/* TODO: color (two RRGGBB values) */
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -575,7 +575,7 @@ test_section_mouse(void)
|
|||
test_boolean(&ctx, &parse_section_mouse, "alternate-scroll-mode",
|
||||
&conf.mouse.alternate_scroll_mode);
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -630,7 +630,7 @@ test_section_colors(void)
|
|||
/* TODO: jump-labels (two colors) */
|
||||
/* TODO: scrollback-indicator (two colors) */
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -670,7 +670,7 @@ test_section_csd(void)
|
|||
/* TODO: verify the ‘set’ bit is actually set for colors */
|
||||
/* TODO: font */
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -970,7 +970,7 @@ test_section_key_bindings(void)
|
|||
binding_action_map, &conf.bindings.key, KEY_BINDING);
|
||||
}
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -983,7 +983,7 @@ test_section_key_bindings_collisions(void)
|
|||
test_binding_collisions(
|
||||
&ctx, BIND_ACTION_KEY_COUNT - 1, binding_action_map, KEY_BINDING);
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1005,7 +1005,7 @@ test_section_search_bindings(void)
|
|||
search_binding_action_map, &conf.bindings.search, KEY_BINDING);
|
||||
}
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1019,7 +1019,7 @@ test_section_search_bindings_collisions(void)
|
|||
&ctx,
|
||||
BIND_ACTION_SEARCH_COUNT - 1, search_binding_action_map, KEY_BINDING);
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1041,7 +1041,7 @@ test_section_url_bindings(void)
|
|||
url_binding_action_map, &conf.bindings.url, KEY_BINDING);
|
||||
}
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1055,7 +1055,7 @@ test_section_url_bindings_collisions(void)
|
|||
&ctx,
|
||||
BIND_ACTION_URL_COUNT - 1, url_binding_action_map, KEY_BINDING);
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1077,7 +1077,7 @@ test_section_mouse_bindings(void)
|
|||
binding_action_map, &conf.bindings.mouse, MOUSE_BINDING);
|
||||
}
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1091,7 +1091,7 @@ test_section_mouse_bindings_collisions(void)
|
|||
&ctx,
|
||||
BIND_ACTION_COUNT - 1, binding_action_map, MOUSE_BINDING);
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1127,7 +1127,7 @@ test_section_text_bindings(void)
|
|||
ctx.value = "InvalidMod+y";
|
||||
xassert(!parse_section_text_bindings(&ctx));
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1201,7 +1201,7 @@ test_section_tweak(void)
|
|||
&conf.tweak.max_shm_pool_size);
|
||||
#endif
|
||||
|
||||
config_free(conf);
|
||||
config_free(&conf);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue