summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2012-03-15 21:46:13 -0400
committerStephen Gallagher <sgallagh@redhat.com>2012-04-05 11:20:08 -0700
commit6c6fdda6b4353869fc2c4fc9c8bdc29badfd10d7 (patch)
treea2168647df2df37f0caed7270ad8d7d531e7b1cf
parent100d9ed10ce27cf98abfbb6f4236bb3577b27913 (diff)
downloadding-libs-6c6fdda6b4353869fc2c4fc9c8bdc29badfd10d7.tar.gz
ding-libs-6c6fdda6b4353869fc2c4fc9c8bdc29badfd10d7.tar.xz
ding-libs-6c6fdda6b4353869fc2c4fc9c8bdc29badfd10d7.zip
Change parse_error to use save_error
* Changed parse_error to use save_error function created in previous commit. * Fixed comment to be more clear.
-rw-r--r--ini/ini_parse.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/ini/ini_parse.c b/ini/ini_parse.c
index b16b9d1..95c3d91 100644
--- a/ini/ini_parse.c
+++ b/ini/ini_parse.c
@@ -979,20 +979,19 @@ static int parser_error(struct parser_obj *po)
{
int error = EOK;
uint32_t action;
- int idx = 0;
- const char *errtxt[] = { ERROR_TXT, WARNING_TXT };
- struct ini_parse_error pe;
+ const char *err_str;
TRACE_FLOW_ENTRY();
- pe.line = po->linenum;
- /* Clear the warning bit */
- pe.error = po->last_error & ~INI_WARNING;
- if (po->last_error & INI_WARNING) idx = 1;
- error = col_add_binary_property(po->el, NULL,
- errtxt[idx], &pe, sizeof(pe));
+ if (po->last_error & INI_WARNING) err_str = WARNING_TXT;
+ else err_str = ERROR_TXT;
+
+ error = save_error(po->el,
+ po->linenum,
+ po->last_error & ~INI_WARNING,
+ err_str);
if (error) {
- TRACE_ERROR_NUMBER("Failed to add error to collection",
+ TRACE_ERROR_NUMBER("Failed to add error to error list",
error);
return error;
}
@@ -1042,7 +1041,9 @@ static int parser_error(struct parser_obj *po)
/* If merging sections should produce error and we got error
* or if we merge sections but dup values produce error and
* we got error then it is not a fatal error so we need to handle
- * it nicely. We check for reverse condition and return error,
+ * it nicely and suppress it here. We already in the procees
+ * of handling another error and merge error does not matter here.
+ * We check for reverse condition and return error,
* otherwise fall through.
*/
if (!((((po->collision_flags & INI_MS_MASK) == INI_MS_ERROR) &&