diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-04-01 20:56:11 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-04-01 20:56:11 +0200 |
commit | 4aabe8681fd88dbb412b8ac69805d92713ca2ecc (patch) | |
tree | eb79f8b87fa008601ca7d2fa1138b958ba7f55d5 /src/plugins/alias/alias-config.c | |
parent | 3e9524ee656568ec4164b083bc9e847e91a35392 (diff) | |
download | weechat-4aabe8681fd88dbb412b8ac69805d92713ca2ecc.zip |
core, plugins: set options to NULL by default, refactor config init functions
Diffstat (limited to 'src/plugins/alias/alias-config.c')
-rw-r--r-- | src/plugins/alias/alias-config.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/plugins/alias/alias-config.c b/src/plugins/alias/alias-config.c index f6b72f4b0..7d65a1c1b 100644 --- a/src/plugins/alias/alias-config.c +++ b/src/plugins/alias/alias-config.c @@ -432,35 +432,31 @@ alias_config_update_cb (const void *pointer, void *data, int alias_config_init () { - struct t_config_section *ptr_section; - alias_config_file = weechat_config_new (ALIAS_CONFIG_PRIO_NAME, &alias_config_reload, NULL, NULL); if (!alias_config_file) return 0; - weechat_config_set_version (alias_config_file, ALIAS_CONFIG_VERSION, - &alias_config_update_cb, NULL, NULL); + if (!weechat_config_set_version (alias_config_file, ALIAS_CONFIG_VERSION, + &alias_config_update_cb, NULL, NULL)) + { + weechat_config_free (alias_config_file); + alias_config_file = NULL; + return 0; + } /* cmd */ - ptr_section = weechat_config_new_section ( + alias_config_section_cmd = weechat_config_new_section ( alias_config_file, "cmd", 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, &alias_config_cmd_write_default_cb, NULL, NULL, &alias_config_cmd_create_option_cb, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (alias_config_file); - alias_config_file = NULL; - return 0; - } - alias_config_section_cmd = ptr_section; + NULL, NULL, NULL); /* completion */ - ptr_section = weechat_config_new_section ( + alias_config_section_completion = weechat_config_new_section ( alias_config_file, "completion", 1, 1, NULL, NULL, NULL, @@ -468,13 +464,6 @@ alias_config_init () &alias_config_completion_write_default_cb, NULL, NULL, &alias_config_completion_create_option_cb, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (alias_config_file); - alias_config_file = NULL; - return 0; - } - alias_config_section_completion = ptr_section; return 1; } |