diff --git a/degesch.c b/degesch.c index 7e50ad9..35e7891 100644 --- a/degesch.c +++ b/degesch.c @@ -1669,6 +1669,20 @@ get_config_boolean (struct config_item_ *root, const char *key) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +static struct str_map * +get_servers_config (struct app_context *ctx) +{ + return &config_item_get (ctx->config.root, "servers", NULL)->value.object; +} + +static struct str_map * +get_aliases_config (struct app_context *ctx) +{ + return &config_item_get (ctx->config.root, "aliases", NULL)->value.object; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + static char * write_configuration_file (const struct str *data, struct error **e) { @@ -6294,12 +6308,6 @@ dump_matching_options // --- Server management ------------------------------------------------------- -static struct str_map * -get_servers_config (struct app_context *ctx) -{ - return &config_item_get (ctx->config.root, "servers", NULL)->value.object; -} - static bool validate_server_name (const char *name) { @@ -7684,10 +7692,8 @@ expand_alias_definition (const struct str *definition, const char *arguments) static char * expand_alias (struct app_context *ctx, const char *alias_name, char *input) { - struct str_map *aliases = - &config_item_get (ctx->config.root, "aliases", NULL)->value.object; - - struct config_item_ *entry = str_map_find (aliases, alias_name); + struct config_item_ *entry = + str_map_find (get_aliases_config (ctx), alias_name); if (!entry) return NULL; @@ -8612,8 +8618,7 @@ const char *g_default_aliases[][2] = static void load_default_aliases (struct app_context *ctx) { - struct str_map *aliases = - &config_item_get (ctx->config.root, "aliases", NULL)->value.object; + struct str_map *aliases = get_aliases_config (ctx); for (size_t i = 0; i < N_ELEMENTS (g_default_aliases); i++) { const char **pair = g_default_aliases[i];