From 27cf7bc5c1089380cc7bc893deee8eb88db2d3d4 Mon Sep 17 00:00:00 2001 From: Dmitri Pal Date: Sat, 25 Dec 2010 23:44:52 -0500 Subject: [INI] Add save_error function Create a function to add error into error list. --- ini/ini_parse.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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) { -- cgit