From 8654e77c640ac19e6997542589fbd1500ae6532d Mon Sep 17 00:00:00 2001
From: Dmitri Pal <dpal@redhat.com>
Date: Sun, 26 Dec 2010 21:45:39 -0500
Subject: [PATCH] [INI] Rename error print function

All config file processing functions start with "ini_config".
The only function that does not comply is
ini_print_errors. We can't rename it since
it is a part of the current active interface.
I marked that function needs to be removed when we
remove old interface and created a copy with
the correct name. I also updated unit test accordingly.
---
 ini/ini_configobj.h |    5 +----
 ini/ini_parse_ut.c  |    8 ++++----
 ini/ini_print.c     |   24 ++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/ini/ini_configobj.h b/ini/ini_configobj.h
index 913b91e6abed18d30ba256edc280a1d0aa9d76ef..7089b62da31887e21eeffd6dceff76907ca9f1a6 100644
--- a/ini/ini_configobj.h
+++ b/ini/ini_configobj.h
@@ -300,10 +300,7 @@ int ini_config_copy(struct ini_cfgobj *ini_config,
                     struct ini_cfgobj **ini_new);
 
 /* Function to print errors from the list */
-void ini_print_errors(FILE *file, char **error_list);
-
-
-
+void ini_config_print_errors(FILE *file, char **error_list);
 
 /* Merge two configurations together creating a new one */
 int ini_config_merge(struct ini_cfgobj *first,
diff --git a/ini/ini_parse_ut.c b/ini/ini_parse_ut.c
index f5b1c2c5b4e82de2baf29955901da28afc082cbb..696735aacee25fc71f2b60708aaf3d0e14081f2c 100644
--- a/ini/ini_parse_ut.c
+++ b/ini/ini_parse_ut.c
@@ -85,7 +85,7 @@ int test_one_file(const char *in_filename,
             INIOUT(printf("Errors detected while parsing: %s\n",
                    ini_config_get_filename(file_ctx)));
             ini_config_get_errors(file_ctx, &error_list);
-            INIOUT(ini_print_errors(stdout, error_list));
+            INIOUT(ini_config_print_errors(stdout, error_list));
             ini_config_free_errors(error_list);
         }
         /* We do not return here intentionally */
@@ -371,7 +371,7 @@ int merge_values_test(void)
                 INIOUT(printf("Errors detected while parsing: %s\n",
                        ini_config_get_filename(file_ctx)));
                 ini_config_get_errors(file_ctx, &error_list);
-                INIOUT(ini_print_errors(stdout, error_list));
+                INIOUT(ini_config_print_errors(stdout, error_list));
                 ini_config_free_errors(error_list);
             }
 
@@ -548,7 +548,7 @@ int merge_section_test(void)
                     INIOUT(printf("Errors detected while parsing: %s\n",
                            ini_config_get_filename(file_ctx)));
                     ini_config_get_errors(file_ctx, &error_list);
-                    INIOUT(ini_print_errors(stdout, error_list));
+                    INIOUT(ini_config_print_errors(stdout, error_list));
                     ini_config_free_errors(error_list);
                 }
 
@@ -706,7 +706,7 @@ int startup_test(void)
             INIOUT(printf("Errors detected while parsing: %s\n",
                    ini_config_get_filename(file_ctx)));
             ini_config_get_errors(file_ctx, &error_list);
-            INIOUT(ini_print_errors(stdout, error_list));
+            INIOUT(ini_config_print_errors(stdout, error_list));
             ini_config_free_errors(error_list);
         }
         /* We do not return here intentionally */
diff --git a/ini/ini_print.c b/ini/ini_print.c
index 1dcfa54bfd72daf2c790d04c37ff2b3107eb7295..42bd6fc221c71bf4f390a79e02a4928ecf747bd9 100644
--- a/ini/ini_print.c
+++ b/ini/ini_print.c
@@ -461,6 +461,9 @@ void print_config_parsing_errors(FILE *file,
 
 
 /* Function to print errors from the list */
+/* THIS FUNCTION SHOUD BE REMOVED WHEN
+ * OLD INTERFACE IS REMOVED - TBD.
+ */
 void ini_print_errors(FILE *file, char **error_list)
 {
     unsigned count = 0;
@@ -480,3 +483,24 @@ void ini_print_errors(FILE *file, char **error_list)
     TRACE_FLOW_EXIT();
     return;
 }
+
+/* Function to print errors from the list */
+void ini_config_print_errors(FILE *file, char **error_list)
+{
+    unsigned count = 0;
+
+    TRACE_FLOW_ENTRY();
+
+    if (!error_list) {
+        TRACE_FLOW_STRING("List is empty.", "");
+        return;
+    }
+
+    while (error_list[count]) {
+        fprintf(file, "%s\n", error_list[count]);
+        count++;
+    }
+
+    TRACE_FLOW_EXIT();
+    return;
+}
-- 
1.5.5.6

