summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2010-12-25 23:44:52 -0500
committerDmitri Pal <dpal@redhat.com>2011-01-03 15:00:42 -0500
commit27cf7bc5c1089380cc7bc893deee8eb88db2d3d4 (patch)
tree4ce4fca3d30c34766267bb719a3e7491795b73af
parent45efaa8dc8de649d4714066ccd3b8441dd55b0e6 (diff)
downloadding-libs-27cf7bc5c1089380cc7bc893deee8eb88db2d3d4.tar.gz
ding-libs-27cf7bc5c1089380cc7bc893deee8eb88db2d3d4.tar.xz
ding-libs-27cf7bc5c1089380cc7bc893deee8eb88db2d3d4.zip
[INI] Add save_error function
Create a function to add error into error list.
-rw-r--r--ini/ini_parse.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/ini/ini_parse.c b/ini/ini_parse.c
index 9667a02..a2e05f9 100644
--- a/ini/ini_parse.c
+++ b/ini/ini_parse.c
@@ -99,6 +99,13 @@ typedef int (*action_fn)(struct parser_obj *);
#define PARSE_ERROR 3 /* Handle error */
#define PARSE_DONE 4 /* We are done */
+/* Declarations of the reusble functions: */
+static int complete_value_processing(struct parser_obj *po);
+static int save_error(struct collection_item *el,
+ unsigned line,
+ int error,
+ int idx);
+
int is_just_spaces(const char *str, uint32_t len)
{
@@ -946,6 +953,28 @@ static int parser_post(struct parser_obj *po)
return EOK;
}
+
+static int save_error(struct collection_item *el,
+ unsigned line,
+ int inerr,
+ int idx)
+{
+ int error = EOK;
+ const char *errtxt[] = { ERROR_TXT, WARNING_TXT };
+ struct ini_parse_error pe;
+
+ TRACE_FLOW_ENTRY();
+
+ /* Clear the warning bit */
+ pe.error = inerr;
+ pe.line = line;
+ error = col_add_binary_property(el, NULL,
+ errtxt[idx], &pe, sizeof(pe));
+ TRACE_FLOW_RETURN(error);
+ return error;
+}
+
+
/* Error and warning processing */
static int parser_error(struct parser_obj *po)
{