Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rpm-software-management/createrepo_c.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleš Matěj <amatej@redhat.com>2022-03-17 16:29:47 +0300
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>2022-03-29 07:56:13 +0300
commitdc4542488c09f4d51f04f79ea146d6d79085bbc1 (patch)
treee613c4a49cea0776162f7030868e092afb9f5ab8 /src
parenta5a5cf64c73dcd2c07f4902efef44ec07ae365d7 (diff)
Remove C API for cr_xml_parse_main_metadata_together
It is obsoleted by cr_PkgIterator_new and its API. It also converts some of the tests to using cr_PkgIterator.
Diffstat (limited to 'src')
-rw-r--r--src/xml_parser.h38
-rw-r--r--src/xml_parser_main_metadata_together.c59
2 files changed, 0 insertions, 97 deletions
diff --git a/src/xml_parser.h b/src/xml_parser.h
index 6e1e3f1..26bd06c 100644
--- a/src/xml_parser.h
+++ b/src/xml_parser.h
@@ -278,44 +278,6 @@ cr_xml_parse_updateinfo(const char *path,
void *warningcb_data,
GError **err);
-/** Parse all 3 main metadata types (primary, filelists and other) at the same time.
- * Once a package is fully parsed pkgcb is called, if a cr_Package wasn't provided using
- * newpkgcb new cr_Package is created and its ownership is transferred to the user by the
- * pkgcb call.
- * This means we don't have store all the packages in memory at the same time, which
- * significantly reduces the memory footprint.
- * Input metadata files can be compressed.
- * Metadata primary, filelists and other have to have the packages in the same order.
- * @param primary_path Path to a primary xml file.
- * @param filelists_path Path to a filelists xml file.
- * @param other_path Path to an other xml file.
- * @param newpkgcb Callback for a new package. Called when the new package
- * xml chunk is found and a package object to store the data
- * is needed. If this callback is used, the user has full
- * ownership of the package, it will not be freed if the
- * parsing is interrupted or there is an error.
- * @param newpkgcb_data User data for the newpkgcb.
- * @param pkgcb Package callback. Called when a package is completely
- * parsed containing information from all 3 main metadata
- * files. Could be NULL if newpkgcb is not NULL.
- * @param pkgcb_data User data for the pkgcb.
- * @param warningcb Callback for warning messages.
- * @param warningcb_data User data for the warningcb.
- * @param err GError **
- * @return cr_Error code.
- */
-int
-cr_xml_parse_main_metadata_together(const char *primary_path,
- const char *filelists_path,
- const char *other_path,
- cr_XmlParserNewPkgCb newpkgcb,
- void *newpkgcb_data,
- cr_XmlParserPkgCb pkgcb,
- void *pkgcb_data,
- cr_XmlParserWarningCb warningcb,
- void *warningcb_data,
- GError **err);
-
typedef struct _cr_PkgIterator cr_PkgIterator;
cr_PkgIterator *
diff --git a/src/xml_parser_main_metadata_together.c b/src/xml_parser_main_metadata_together.c
index 3836fbb..684cf27 100644
--- a/src/xml_parser_main_metadata_together.c
+++ b/src/xml_parser_main_metadata_together.c
@@ -319,65 +319,6 @@ parse_next_section(CR_FILE *target_file, const char *path, cr_ParserData *pd, GE
//TODO(amatej): there is quite some overlap with this and cr_load_xml_files,
// consider using this api to implement cr_load_xml_files?
-int cr_xml_parse_main_metadata_together(const char *primary_path,
- const char *filelists_path,
- const char *other_path,
- cr_XmlParserNewPkgCb newpkgcb,
- void *newpkgcb_data,
- cr_XmlParserPkgCb pkgcb,
- void *pkgcb_data,
- cr_XmlParserWarningCb warningcb,
- void *warningcb_data,
- GError **err)
-{
- assert(pkgcb || newpkgcb);
- cr_PkgIterator* pkg_iterator = cr_PkgIterator_new(
- primary_path, filelists_path, other_path, newpkgcb, newpkgcb_data, warningcb, warningcb_data, err
- );
-
- if (*err) {
- return (*err)->code;
- }
-
- assert(pkg_iterator);
- cr_Package* package = NULL;
- GError* tmp_err = NULL;
-
- while (package = cr_PkgIterator_parse_next(pkg_iterator, err)) {
- if (pkgcb) {
- // call user package callback
- // pkgcb() destroys the package!!
- if (pkgcb(package, pkgcb_data, &tmp_err)) {
- // Error condition
- if (tmp_err) {
- g_propagate_prefixed_error(err, tmp_err, "Parsing interrupted: ");
- } else {
- g_set_error(err, ERR_DOMAIN, CRE_CBINTERRUPTED, "Parsing interrupted");
- }
- cr_PkgIterator_free(pkg_iterator, err);
- return CRE_CBINTERRUPTED;
- } else {
- // If callback return CRE_OK but it simultaneously set
- // the tmp_err then it's a programming error.
- assert(tmp_err == NULL);
- }
- } else {
- // Free the package if there is no external callback to do so and we have no newpkgcb
- if (!newpkgcb) {
- cr_package_free(package);
- }
- }
- }
-
- cr_PkgIterator_free(pkg_iterator, err);
-
- if (*err) {
- return (*err)->code;
- } else {
- return CRE_OK;
- }
-}
-
// TODO: maybe whether or not individual files are parsed could be controlled by NULL paths? I think cr_load_xml_files
// already works that way.
cr_PkgIterator *