From 82c9b365edba8bb9da88b3cc9f2989fd861752e5 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Thu, 22 Jun 2017 09:04:16 +0900 Subject: [PATCH] Consolidate error/warning output code --- config.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/config.c b/config.c index f97f99b6..40349532 100644 --- a/config.c +++ b/config.c @@ -177,13 +177,9 @@ parse_config(t_configuration_options *options, bool terse) if (terse == false && config_warnings.head != NULL) { - ItemListCell *cell; - log_warning(_("the following problems were found in the configuration file:")); - for (cell = config_warnings.head; cell; cell = cell->next) - { - fprintf(stderr, " %s\n", cell->string); - } + + print_item_list(&config_warnings); } return true; @@ -651,24 +647,16 @@ reload_config(t_configuration_options *orig_options) static void exit_with_config_file_errors(ItemList *config_errors, ItemList *config_warnings, bool terse) { - ItemListCell *cell; - - log_error(_("following errors were found in the configuration file:")); - for (cell = config_errors->head; cell; cell = cell->next) - { - fprintf(stderr, " %s\n", cell->string); - } + print_item_list(config_errors); if (terse == false && config_warnings->head != NULL) { puts(""); log_warning(_("the following problems were also found in the configuration file:")); - for (cell = config_warnings->head; cell; cell = cell->next) - { - fprintf(stderr, " %s\n", cell->string); - } + + print_item_list(config_warnings); } exit(ERR_BAD_CONFIG);