} cr_CbData;
static int
-warning_cb(cr_XmlParserWarningType type,
- char *msg,
- void *cbdata,
- GError **err)
-{
- CR_UNUSED(type);
- CR_UNUSED(err);
-
- g_warning("%s: %s", cbdata, msg);
-}
-
-static int
primary_newpkgcb(cr_Package **pkg,
const char *pkgId,
const char *name,
&cb_data,
primary_pkgcb,
&cb_data,
- warning_cb,
+ cr_warning_cb,
"Primary XML parser",
(filelists_xml_path) ? 0 : 1,
&tmp_err);
&cb_data,
pkgcb,
&cb_data,
- warning_cb,
+ cr_warning_cb,
"Filelists XML parser",
&tmp_err);
if (tmp_err) {
&cb_data,
pkgcb,
&cb_data,
- warning_cb,
+ cr_warning_cb,
"Other XML parser",
&tmp_err);
if (tmp_err) {
g_free(ml);
}
-static int
-warning_cb(cr_XmlParserWarningType type,
- char *msg,
- void *cbdata,
- GError **err)
-{
- CR_UNUSED(type);
- CR_UNUSED(cbdata);
- CR_UNUSED(err);
-
- g_warning("Repomd xml parser: %s", msg);
-}
-
static struct cr_MetadataLocation *
cr_parse_repomd(const char *repomd_path,
const char *repopath,
GError *tmp_err = NULL;
cr_Repomd *repomd = cr_repomd_new();
- cr_xml_parse_repomd(repomd_path, repomd, warning_cb, NULL, &tmp_err);
+ cr_xml_parse_repomd(repomd_path, repomd, cr_warning_cb,
+ "Repomd xml parser", &tmp_err);
if (tmp_err) {
g_error("%s: %s", __func__, tmp_err->message);
g_error_free(tmp_err);
rc = cr_compare_values(r1, r2);
return rc;
}
+
+int
+cr_warning_cb(cr_XmlParserWarningType type,
+ char *msg,
+ void *cbdata,
+ GError **err)
+{
+ CR_UNUSED(type);
+ CR_UNUSED(err);
+
+ g_warning("%s: %s", cbdata, msg);
+}
#include <string.h>
#include <curl/curl.h>
#include "compression_wrapper.h"
+#include "xml_parser.h"
/** \defgroup misc Miscellaneous useful functions and macros.
* \addtogroup misc
return g_string_chunk_insert_const(chunk, str);
}
+/** Warning callback for xml parser warnings.
+ * For use in xml parsers like primary, filelists, other or repomd parser.
+ * Name of the parser should be passed as a string via
+ * warning callback data (warningcb_data) argument of the parser.
+ */
+int
+cr_warning_cb(cr_XmlParserWarningType type,
+ char *msg,
+ void *cbdata,
+ GError **err);
+
/** @} */
#ifdef __cplusplus