X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=ext%2Frepo_products.c;h=edf15bf7cc3eceb0fe766ba6bea9ede4a53349b4;hb=79b3a6b7ab494c5ff10e740fd147f21a04907907;hp=154a909f64cad59f9a31caff965a169a26441473;hpb=26781f8c44b4495fba2d0f4a39fe6379b08f32ce;p=platform%2Fupstream%2Flibsolv.git diff --git a/ext/repo_products.c b/ext/repo_products.c index 154a909..edf15bf 100644 --- a/ext/repo_products.c +++ b/ext/repo_products.c @@ -291,19 +291,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: %s at line %u:%u\n", pd->filename, errstr, line, column); - if (pd->solvable) - { - repo_free_solvable(pd->repo, pd->solvable - pd->pool->solvables, 1); - pd->solvable = 0; - } -} - - int repo_add_code11_products(Repo *repo, const char *dirpath, int flags) { @@ -318,7 +305,7 @@ repo_add_code11_products(Repo *repo, const char *dirpath, int flags) 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); if (flags & REPO_USE_ROOTDIR) dirpath = pool_prepend_rootdir(repo->pool, dirpath); @@ -358,7 +345,11 @@ repo_add_code11_products(Repo *repo, const char *dirpath, int flags) pd.ctime = (unsigned int)st.st_ctime; pd.filename = fullpath; pd.basename = entry->d_name; - solv_xmlparser_parse(&pd.xmlp, fp); + if (solv_xmlparser_parse(&pd.xmlp, fp) != SOLV_XMLPARSER_OK) + { + pool_debug(pd.pool, SOLV_ERROR, "%s: %s at line %u:%u\n", pd.filename, pd.xmlp.errstr, pd.xmlp.line, pd.xmlp.column); + pd.solvable = solvable_free(pd.solvable, 1); + } fclose(fp); } closedir(dir);