Imported Upstream version 0.7.2
[platform/upstream/libsolv.git] / ext / repo_mdk.c
index 418bc61..4d3e102 100644 (file)
@@ -230,7 +230,7 @@ repo_add_mdk(Repo *repo, FILE *fp, int flags)
   if (s)
     {
       pool_debug(pool, SOLV_ERROR, "unclosed package at EOF\n");
-      repo_free_solvable(s->repo, s - pool->solvables, 1);
+      s = solvable_free(s, 1);
     }
   solv_free(buf);
   if (!(flags & REPO_NO_INTERNALIZE))
@@ -437,14 +437,6 @@ endElement(struct solv_xmlparser *xmlp, int state, char *content)
     }
 }
 
-static void
-errorCallback(struct solv_xmlparser *xmlp, const char *errstr, unsigned int line, unsigned int column)
-{
-  struct parsedata *pd = xmlp->userdata;
-  pool_debug(pd->pool, SOLV_ERROR, "%s at line %u:%u\n", errstr, line, column);
-}
-
-
 int
 repo_add_mdk_info(Repo *repo, FILE *fp, int flags)
 {
@@ -463,9 +455,10 @@ repo_add_mdk_info(Repo *repo, FILE *fp, int flags)
   pd.repo = repo;
   pd.pool = repo->pool;
   pd.data = data;
-  solv_xmlparser_init(&pd.xmlp, stateswitches, &pd, startElement, endElement, errorCallback);
+  solv_xmlparser_init(&pd.xmlp, stateswitches, &pd, startElement, endElement);
   pd.joinhash = joinhash_init(repo, &pd.joinhashmask);
-  solv_xmlparser_parse(&pd.xmlp, fp);
+  if (solv_xmlparser_parse(&pd.xmlp, fp) != SOLV_XMLPARSER_OK)
+    pool_debug(pd.pool, SOLV_ERROR, "%s at line %u:%u\n", pd.xmlp.errstr, pd.xmlp.line, pd.xmlp.column);
   solv_xmlparser_free(&pd.xmlp);
   solv_free(pd.joinhash);
   if (!(flags & REPO_NO_INTERNALIZE))