summaryrefslogtreecommitdiffstats
path: root/ini/ini_print.c
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2010-12-25 23:24:35 -0500
committerStephen Gallagher <sgallagh@redhat.com>2012-04-05 11:20:08 -0700
commit142396b25e68e254f7bc3478d9467158f0fb0eb7 (patch)
treefaac7a19949ac9291617b52447b75ed9f76126fd /ini/ini_print.c
parentcf667071bab4673468b10c837a024aae30f3f9af (diff)
downloadding-libs-142396b25e68e254f7bc3478d9467158f0fb0eb7.tar.gz
ding-libs-142396b25e68e254f7bc3478d9467158f0fb0eb7.tar.xz
ding-libs-142396b25e68e254f7bc3478d9467158f0fb0eb7.zip
New error codes and messages
Patch consists of two parts: * Adding new constants for error messages to ini_configobj.h file * Making ini_print.c use this header file instead of the old one. Converting this to enums is tracked as a separate ticket.
Diffstat (limited to 'ini/ini_print.c')
-rw-r--r--ini/ini_print.c54
1 files changed, 50 insertions, 4 deletions
diff --git a/ini/ini_print.c b/ini/ini_print.c
index 0430976..1dcfa54 100644
--- a/ini/ini_print.c
+++ b/ini/ini_print.c
@@ -31,7 +31,8 @@
#include "collection.h"
#include "collection_tools.h"
#include "ini_defines.h"
-#include "ini_config.h"
+#include "ini_config_priv.h"
+#include "ini_configobj.h"
/*============================================================*/
@@ -42,6 +43,16 @@
* check that the class IDs did not get reused over time by
* other classes.
*/
+/**
+ * @brief Collection of error collections.
+ *
+ * When multiple files are read during one call
+ * each file has its own set of parsing errors
+ * and warnings. This is the collection
+ * of such sets.
+ */
+#define COL_CLASS_INI_PESET COL_CLASS_INI_BASE + 3
+
/** @brief Collection of grammar errors.
*
* Reserved for future use.
@@ -53,6 +64,37 @@
*/
#define COL_CLASS_INI_VERROR COL_CLASS_INI_BASE + 6
+/**
+ * @}
+ */
+
+/**
+ * @defgroup gramerr Grammar errors and warnings
+ *
+ * Placeholder for now. Reserved for future use.
+ *
+ * @{
+ */
+#define ERR_MAXGRAMMAR 0
+/**
+ * @}
+ */
+
+/**
+ * @defgroup valerr Validation errors and warnings
+ *
+ * Placeholder for now. Reserved for future use.
+ *
+ * @{
+ */
+#define ERR_MAXVALID 0
+
+
+/**
+ * @}
+ */
+
+
#ifdef HAVE_VALIDATION
/** @brief Collection of lines from the INI file.
@@ -78,7 +120,11 @@ static const char *parsing_error_str(int parsing_error)
_("Property name is too long."),
_("Failed to read line."),
_("Invalid space character at the "
- "beginning of the line.")
+ "beginning of the line."),
+ _("Duplicate key is not allowed."),
+ _("Duplicate key is detected while "
+ "merging sections."),
+ _("Duplicate section is not allowed.")
};
/* Check the range */
@@ -208,7 +254,7 @@ static void print_error_list(FILE *file,
struct collection_iterator *iterator;
int error;
struct collection_item *item = NULL;
- struct parse_error *pe;
+ struct ini_parse_error *pe;
unsigned int count;
TRACE_FLOW_STRING("print_error_list", "Entry");
@@ -256,7 +302,7 @@ static void print_error_list(FILE *file,
}
else {
/* Put error into provided format */
- pe = (struct parse_error *)(col_get_item_data(item));
+ pe = (struct ini_parse_error *)(col_get_item_data(item));
fprintf(file, line_format,
col_get_item_property(item, NULL), /* Error or warning */
pe->error, /* Error */