From: Michael Tremer Date: Fri, 27 Jun 2025 14:44:11 +0000 (+0000) Subject: repo: Create its own type X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21d186ba55873c1c5bf6737ffabfb17a42701848;p=pakfire.git repo: Create its own type Signed-off-by: Michael Tremer --- diff --git a/src/cli/lib/build.c b/src/cli/lib/build.c index 78bffaca..869b5fb2 100644 --- a/src/cli/lib/build.c +++ b/src/cli/lib/build.c @@ -166,7 +166,7 @@ static int result_callback(pakfire_ctx* ctx, struct pakfire* pakfire, pakfire_build* build, pakfire_archive* archive, void* data) { const struct cli_local_args* local_args = data; pakfire_package* pkg = NULL; - struct pakfire_repo* local = NULL; + pakfire_repo* local = NULL; char path[PATH_MAX]; int r; diff --git a/src/cli/lib/dump.c b/src/cli/lib/dump.c index d35d9740..419b2545 100644 --- a/src/cli/lib/dump.c +++ b/src/cli/lib/dump.c @@ -66,7 +66,7 @@ int cli_dump_packagelist(pakfire_packagelist* list, int flags) { } int cli_dump_repolist(pakfire_repolist* list, int flags) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; int r; if (!list) diff --git a/src/cli/lib/pakfire.c b/src/cli/lib/pakfire.c index 89bb5063..bd98bd2d 100644 --- a/src/cli/lib/pakfire.c +++ b/src/cli/lib/pakfire.c @@ -32,7 +32,7 @@ #include "pakfire.h" static void cli_set_repo_enabled(struct pakfire* pakfire, const char* name, int enabled) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; // Find the repository repo = pakfire_get_repo(pakfire, name); diff --git a/src/pakfire/archive.c b/src/pakfire/archive.c index cf85455a..6f556f6a 100644 --- a/src/pakfire/archive.c +++ b/src/pakfire/archive.c @@ -1582,7 +1582,7 @@ static int pakfire_archive_import_filelist_from_json( } static int pakfire_archive_make_package_from_json(pakfire_archive* archive, - struct pakfire_repo* repo, pakfire_package** package) { + pakfire_repo* repo, pakfire_package** package) { pakfire_package* pkg = NULL; char path[PATH_MAX]; int r; @@ -1869,8 +1869,8 @@ ERROR: Copy all metadata from this archive to the package object */ int pakfire_archive_make_package(pakfire_archive* archive, - struct pakfire_repo* repo, pakfire_package** package) { - struct pakfire_repo* dummy = NULL; + pakfire_repo* repo, pakfire_package** package) { + pakfire_repo* dummy = NULL; int r; // Use dummy repo if no repository was passed diff --git a/src/pakfire/archive.h b/src/pakfire/archive.h index 0778bf55..52364627 100644 --- a/src/pakfire/archive.h +++ b/src/pakfire/archive.h @@ -63,7 +63,7 @@ int pakfire_archive_verify_checksum(pakfire_archive* archive, const enum pakfire_hash_type type, const unsigned char* checksum, const size_t length); int pakfire_archive_make_package(pakfire_archive* archive, - struct pakfire_repo* repo, pakfire_package** package); + pakfire_repo* repo, pakfire_package** package); int pakfire_archive_lint(pakfire_archive* archive, pakfire_linter_result_callback callback, void* data); diff --git a/src/pakfire/build.c b/src/pakfire/build.c index 17dd124c..7b8f55dc 100644 --- a/src/pakfire/build.c +++ b/src/pakfire/build.c @@ -91,7 +91,7 @@ struct pakfire_build { pakfire_env* env; // The build repository - struct pakfire_repo* repo; + pakfire_repo* repo; // Buildroot char buildroot[PATH_MAX]; @@ -168,7 +168,7 @@ static int pakfire_build_output_callback(pakfire_ctx* ctx, void* data, } static int __pakfire_build_setup_repo(struct pakfire* pakfire, - struct pakfire_repo* repo, void* p) { + pakfire_repo* repo, void* p) { char path[PATH_MAX]; FILE* f = NULL; int r; @@ -2821,7 +2821,7 @@ ERROR: } int pakfire_build_clean(struct pakfire* pakfire, int flags) { - struct pakfire_repo* local = NULL; + pakfire_repo* local = NULL; int r = 0; pakfire_ctx* ctx = pakfire_get_ctx(pakfire); diff --git a/src/pakfire/db.c b/src/pakfire/db.c index 98258ea5..387ea74e 100644 --- a/src/pakfire/db.c +++ b/src/pakfire/db.c @@ -1586,7 +1586,7 @@ int pakfire_db_add_package(pakfire_db* db, } // Bind repository name - struct pakfire_repo* repo = pakfire_package_get_repo(pkg); + pakfire_repo* repo = pakfire_package_get_repo(pkg); if (repo) { const char* repo_name = pakfire_repo_get_name(repo); pakfire_repo_unref(repo); @@ -1826,7 +1826,7 @@ ERROR: return scriptlet; } -static int pakfire_db_load_package(pakfire_db* db, struct pakfire_repo* repo, sqlite3_stmt* stmt) { +static int pakfire_db_load_package(pakfire_db* db, pakfire_repo* repo, sqlite3_stmt* stmt) { pakfire_package* pkg = NULL; int r = 1; @@ -2059,7 +2059,7 @@ ERROR: return r; } -int pakfire_db_load(pakfire_db* db, struct pakfire_repo* repo) { +int pakfire_db_load(pakfire_db* db, pakfire_repo* repo) { sqlite3_stmt* stmt = NULL; int r = 1; diff --git a/src/pakfire/db.h b/src/pakfire/db.h index 70a601db..f3069b87 100644 --- a/src/pakfire/db.h +++ b/src/pakfire/db.h @@ -49,7 +49,7 @@ int pakfire_db_add_package(pakfire_db* db, pakfire_package* pkg, pakfire_archive* archive, int userinstalled); int pakfire_db_remove_package(pakfire_db* db, pakfire_package* pkg); -int pakfire_db_load(pakfire_db* db, struct pakfire_repo* repo); +int pakfire_db_load(pakfire_db* db, pakfire_repo* repo); struct pakfire_scriptlet* pakfire_db_get_scriptlet( pakfire_db* db, pakfire_package* pkg, const char* type); diff --git a/src/pakfire/package.c b/src/pakfire/package.c index 0566ef70..3f6e6044 100644 --- a/src/pakfire/package.c +++ b/src/pakfire/package.c @@ -62,7 +62,7 @@ struct pakfire_package { // Reference to this package in the SOLV pool Id id; - struct pakfire_repo* repo; + pakfire_repo* repo; char nevra[NAME_MAX]; char source_nevra[NAME_MAX]; @@ -168,7 +168,7 @@ static int pakfire_package_add_self_provides(pakfire_package* pkg) { } int pakfire_package_create_from_solvable(pakfire_package** package, - struct pakfire* pakfire, struct pakfire_repo* repo, Id id) { + struct pakfire* pakfire, pakfire_repo* repo, Id id) { pakfire_package* pkg = NULL; // Allocate some memory @@ -199,9 +199,9 @@ int pakfire_package_create_from_solvable(pakfire_package** package, } int pakfire_package_create(pakfire_package** package, - struct pakfire* pakfire, struct pakfire_repo* repo, + struct pakfire* pakfire, pakfire_repo* repo, const char* name, const char* evr, const char* arch) { - struct pakfire_repo* dummy = NULL; + pakfire_repo* dummy = NULL; int r; // Check for some valid input @@ -347,8 +347,8 @@ int pakfire_package_cmp(pakfire_package* pkg1, pakfire_package* pkg2) { return ret; // Check repositories - struct pakfire_repo* repo1 = pakfire_package_get_repo(pkg1); - struct pakfire_repo* repo2 = pakfire_package_get_repo(pkg2); + pakfire_repo* repo1 = pakfire_package_get_repo(pkg1); + pakfire_repo* repo2 = pakfire_package_get_repo(pkg2); if (repo1 && repo2) { ret = pakfire_repo_cmp(repo1, repo2); @@ -416,7 +416,7 @@ int pakfire_package_is_source(pakfire_package* pkg) { } static void pakfire_package_internalize_repo(pakfire_package* pkg) { - struct pakfire_repo* repo = pakfire_package_get_repo(pkg); + pakfire_repo* repo = pakfire_package_get_repo(pkg); if (repo) { pakfire_repo_internalize(repo, 0); pakfire_repo_unref(repo); @@ -424,7 +424,7 @@ static void pakfire_package_internalize_repo(pakfire_package* pkg) { } static void pakfire_package_has_changed(pakfire_package* pkg) { - struct pakfire_repo* repo = pakfire_package_get_repo(pkg); + pakfire_repo* repo = pakfire_package_get_repo(pkg); if (repo) { pakfire_repo_has_changed(repo); pakfire_repo_unref(repo); @@ -479,7 +479,7 @@ static int pakfire_package_make_path_internal(pakfire_package* self) { return pakfire_string_set(self->local_path, path); } -static int pakfire_package_make_path_local(pakfire_package* self, struct pakfire_repo* repo) { +static int pakfire_package_make_path_local(pakfire_package* self, pakfire_repo* repo) { const char* path = NULL; // Fetch the path @@ -506,7 +506,7 @@ static int pakfire_package_make_path_cache(pakfire_package* self) { Returns the path this package is or should be stored. */ const char* pakfire_package_get_path(pakfire_package* self) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; int r; // Return the cached value if we have one @@ -1335,7 +1335,7 @@ int pakfire_package_get_checksum(pakfire_package* pkg, int pakfire_package_set_checksum(pakfire_package* pkg, const enum pakfire_hash_type hash, const unsigned char* digest, const size_t length) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; Id id = ID_NULL; int r; @@ -1801,7 +1801,7 @@ int pakfire_package_matches_dep(pakfire_package* pkg, return pakfire_package_matches_depid(pkg, key, id); } -struct pakfire_repo* pakfire_package_get_repo(pakfire_package* pkg) { +pakfire_repo* pakfire_package_get_repo(pakfire_package* pkg) { int r; // Open the repository if not done, yet @@ -1932,7 +1932,7 @@ char* pakfire_package_dump(pakfire_package* pkg, int flags) { } // Repository - struct pakfire_repo* repo = pakfire_package_get_repo(pkg); + pakfire_repo* repo = pakfire_package_get_repo(pkg); if (repo) { if (!pakfire_repo_name_equals(repo, PAKFIRE_REPO_DUMMY)) { const char* repo_name = pakfire_repo_get_name(repo); @@ -2255,7 +2255,7 @@ int pakfire_package_append_file(pakfire_package* pkg, const char* path) { int r; // Fetch repodata - struct pakfire_repo* repo = pakfire_package_get_repo(pkg); + pakfire_repo* repo = pakfire_package_get_repo(pkg); if (!repo) { ERROR(pkg->ctx, "Could not find repository for %s: %m\n", pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA)); @@ -2529,7 +2529,7 @@ static int __pakfire_package_add_build_packages(pakfire_ctx* ctx, static int pakfire_package_add_build_packages(pakfire_package* pkg, struct json_object* md) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; struct json_object* object = NULL; int r; diff --git a/src/pakfire/package.h b/src/pakfire/package.h index cc4ee285..1e0f5cc5 100644 --- a/src/pakfire/package.h +++ b/src/pakfire/package.h @@ -81,7 +81,7 @@ enum pakfire_package_key { }; int pakfire_package_create(pakfire_package** package, struct pakfire* pakfire, - struct pakfire_repo* repo, const char* name, const char* evr, const char* arch); + pakfire_repo* repo, const char* name, const char* evr, const char* arch); pakfire_package* pakfire_package_ref(pakfire_package* pkg); pakfire_package* pakfire_package_unref(pakfire_package* pkg); @@ -139,7 +139,7 @@ size_t pakfire_package_get_size(pakfire_package* pkg); int pakfire_package_get_reverse_requires(pakfire_package* pkg, pakfire_packagelist** list); -struct pakfire_repo* pakfire_package_get_repo(pakfire_package* pkg); +pakfire_repo* pakfire_package_get_repo(pakfire_package* pkg); char* pakfire_package_dump(pakfire_package* pkg, int flags); @@ -158,7 +158,7 @@ enum pakfire_package_dump_flags { int pakfire_package_installcheck(pakfire_package* pkg, char** problem, int flags); int pakfire_package_create_from_solvable(pakfire_package** package, - struct pakfire* pakfire, struct pakfire_repo* repo, Id id); + struct pakfire* pakfire, pakfire_repo* repo, Id id); int pakfire_package_set_strings_from_string(pakfire_package* pkg, const enum pakfire_package_key key, const char* value); diff --git a/src/pakfire/pakfire.c b/src/pakfire/pakfire.c index 4cf739ce..62a5ee5a 100644 --- a/src/pakfire/pakfire.c +++ b/src/pakfire/pakfire.c @@ -392,7 +392,7 @@ static int pakfire_setup_pool(struct pakfire* pakfire) { } static int pakfire_load_installed_packages(struct pakfire* self) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; pakfire_db* db = NULL; int r; @@ -419,9 +419,9 @@ ERROR: } static int pakfire_setup_default_repos(struct pakfire* self) { - struct pakfire_repo* commandline = NULL; - struct pakfire_repo* dummy = NULL; - struct pakfire_repo* system = NULL; + pakfire_repo* commandline = NULL; + pakfire_repo* dummy = NULL; + pakfire_repo* system = NULL; int r; // Create a dummy repository @@ -457,7 +457,7 @@ ERROR: } static void pakfire_free(struct pakfire* pakfire) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; int r; // Avoid recursive free @@ -625,7 +625,7 @@ ERROR: } static int pakfire_setup_local_repo(struct pakfire* self) { - struct pakfire_repo* local = NULL; + pakfire_repo* local = NULL; char path[PATH_MAX]; char url[PATH_MAX]; int r; @@ -702,7 +702,7 @@ ERROR: return r; } -static int pakfire_refresh_repo(struct pakfire* pakfire, struct pakfire_repo* repo, void* data) { +static int pakfire_refresh_repo(struct pakfire* pakfire, pakfire_repo* repo, void* data) { return pakfire_repo_refresh(repo, 0); } @@ -1262,7 +1262,7 @@ int __pakfire_cache_path(struct pakfire* pakfire, char* path, size_t length, int pakfire_repo_walk(struct pakfire* pakfire, pakfire_repo_walk_callback callback, void* p) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; Repo* solv_repo = NULL; int i = 0; int r; @@ -1287,7 +1287,7 @@ int pakfire_repo_walk(struct pakfire* pakfire, return 0; } -static int __pakfire_repo_clean(struct pakfire* pakfire, struct pakfire_repo* repo, +static int __pakfire_repo_clean(struct pakfire* pakfire, pakfire_repo* repo, void* p) { int flags = *(int*)p; @@ -1336,7 +1336,7 @@ void pakfire_pool_has_changed(struct pakfire* pakfire) { pakfire->internal_flags &= ~PAKFIRE_POOL_READY; } -static int __pakfire_repo_internalize(struct pakfire* pakfire, struct pakfire_repo* repo, +static int __pakfire_repo_internalize(struct pakfire* pakfire, pakfire_repo* repo, void* p) { int flags = *(int*)p; @@ -1364,7 +1364,7 @@ void pakfire_pool_internalize(struct pakfire* pakfire) { } pakfire_repolist* pakfire_get_repos(struct pakfire* pakfire) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; pakfire_repolist* list; int r = pakfire_repolist_create(&list); @@ -1402,8 +1402,8 @@ ERROR: return NULL; } -struct pakfire_repo* pakfire_get_repo(struct pakfire* pakfire, const char* name) { - struct pakfire_repo* repo = NULL; +pakfire_repo* pakfire_get_repo(struct pakfire* pakfire, const char* name) { + pakfire_repo* repo = NULL; Repo* solv_repo = NULL; int r; int i; @@ -1426,8 +1426,8 @@ struct pakfire_repo* pakfire_get_repo(struct pakfire* pakfire, const char* name) return NULL; } -struct pakfire_repo* pakfire_get_installed_repo(struct pakfire* pakfire) { - struct pakfire_repo* repo = NULL; +pakfire_repo* pakfire_get_installed_repo(struct pakfire* pakfire) { + pakfire_repo* repo = NULL; int r; if (!pakfire->pool->installed) @@ -1444,7 +1444,7 @@ struct pakfire_repo* pakfire_get_installed_repo(struct pakfire* pakfire) { /* Convenience function to dist() a package on the fly */ -static int pakfire_commandline_dist(struct pakfire* pakfire, struct pakfire_repo* repo, +static int pakfire_commandline_dist(struct pakfire* pakfire, pakfire_repo* repo, const char* path, pakfire_package** pkg) { pakfire_archive* archive = NULL; int r; @@ -1471,7 +1471,7 @@ ERROR: */ int pakfire_commandline_add(struct pakfire* pakfire, const char* path, pakfire_package** package) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; int r; // Find the commandline repository diff --git a/src/pakfire/pakfire.h b/src/pakfire/pakfire.h index 045c86cf..7e04b9a3 100644 --- a/src/pakfire/pakfire.h +++ b/src/pakfire/pakfire.h @@ -74,7 +74,7 @@ const char* pakfire_get_arch(struct pakfire* pakfire); int pakfire_version_compare(struct pakfire* pakfire, const char* evr1, const char* evr2); pakfire_repolist* pakfire_get_repos(struct pakfire* pakfire); -struct pakfire_repo* pakfire_get_repo(struct pakfire* pakfire, const char* name); +pakfire_repo* pakfire_get_repo(struct pakfire* pakfire, const char* name); int pakfire_whatprovides(struct pakfire* pakfire, const char* what, int flags, pakfire_packagelist* list); @@ -141,13 +141,13 @@ void pakfire_pool_internalize(struct pakfire* pakfire); Pool* pakfire_get_solv_pool(struct pakfire* pakfire); -struct pakfire_repo* pakfire_get_installed_repo(struct pakfire* pakfire); +pakfire_repo* pakfire_get_installed_repo(struct pakfire* pakfire); int pakfire_commandline_add(struct pakfire* pakfire, const char* path, pakfire_package** package); typedef int (*pakfire_repo_walk_callback) - (struct pakfire* pakfire, struct pakfire_repo* repo, void* p); + (struct pakfire* pakfire, pakfire_repo* repo, void* p); int pakfire_repo_walk(struct pakfire* pakfire, pakfire_repo_walk_callback callback, void* p); diff --git a/src/pakfire/parser.c b/src/pakfire/parser.c index bc2433a3..dbbcd6a8 100644 --- a/src/pakfire/parser.c +++ b/src/pakfire/parser.c @@ -1038,7 +1038,7 @@ int pakfire_parser_set_env(pakfire_parser* parser, pakfire_env* env) { } int pakfire_parser_create_package(pakfire_parser* parser, - pakfire_package** pkg, struct pakfire_repo* repo, const char* namespace, const char* default_arch) { + pakfire_package** pkg, pakfire_repo* repo, const char* namespace, const char* default_arch) { int r = 1; char* name = NULL; diff --git a/src/pakfire/parser.h b/src/pakfire/parser.h index 91f213c5..da39c847 100644 --- a/src/pakfire/parser.h +++ b/src/pakfire/parser.h @@ -70,7 +70,7 @@ const char* pakfire_parser_get_namespace(pakfire_parser* parser); int pakfire_parser_set_namespace(pakfire_parser* parser, const char* namespace); int pakfire_parser_create_package(pakfire_parser* parser, - pakfire_package** pkg, struct pakfire_repo* repo, const char* namespace, const char* default_arch); + pakfire_package** pkg, pakfire_repo* repo, const char* namespace, const char* default_arch); // Errors int pakfire_parser_error_create(pakfire_parser_error** error, diff --git a/src/pakfire/repo.c b/src/pakfire/repo.c index d710df22..7bccaaea 100644 --- a/src/pakfire/repo.c +++ b/src/pakfire/repo.c @@ -63,7 +63,7 @@ #define MAX_DESCRIPTION 4096 -struct pakfire_repomd { +typedef struct pakfire_repomd { // Version int64_t version; @@ -81,9 +81,9 @@ struct pakfire_repomd { // Hashes struct pakfire_hashes hashes; } packages; -}; +} pakfire_repomd; -struct pakfire_repo_appdata { +typedef struct pakfire_repo_appdata { // Reference Counter int nrefs; @@ -91,7 +91,7 @@ struct pakfire_repo_appdata { Repo* repo; // Metadata - struct pakfire_repomd repomd; + pakfire_repomd repomd; // Description char description[MAX_DESCRIPTION]; @@ -121,7 +121,7 @@ struct pakfire_repo_appdata { // Markers int ready:1; -}; +} pakfire_repo_appdata; struct pakfire_repo { pakfire_ctx* ctx; @@ -129,14 +129,14 @@ struct pakfire_repo { int nrefs; Repo* repo; - struct pakfire_repo_appdata* appdata; + pakfire_repo_appdata* appdata; pakfire_key* key; }; -static const char* pakfire_repo_get_expanded_baseurl(struct pakfire_repo* repo); +static const char* pakfire_repo_get_expanded_baseurl(pakfire_repo* repo); -int pakfire_repo_is_internal(struct pakfire_repo* repo) { +int pakfire_repo_is_internal(pakfire_repo* repo) { const char* name = pakfire_repo_get_name(repo); if (!name) return 0; @@ -144,11 +144,11 @@ int pakfire_repo_is_internal(struct pakfire_repo* repo) { return (*name == '@'); } -static int pakfire_repo_is_commandline(struct pakfire_repo* repo) { +static int pakfire_repo_is_commandline(pakfire_repo* repo) { return pakfire_repo_name_equals(repo, PAKFIRE_REPO_COMMANDLINE); } -int pakfire_repo_is_local(struct pakfire_repo* repo) { +int pakfire_repo_is_local(pakfire_repo* repo) { // The commandline repository is semi-local if (pakfire_repo_is_commandline(repo)) return 1; @@ -163,7 +163,7 @@ int pakfire_repo_is_local(struct pakfire_repo* repo) { We set this automatically to reduce bandwidth usage. */ -static void pakfire_repo_update_subpriority(struct pakfire_repo* repo) { +static void pakfire_repo_update_subpriority(pakfire_repo* repo) { // Prefer local repositories if (pakfire_repo_is_local(repo)) repo->repo->subpriority = 1; @@ -178,7 +178,7 @@ static void pakfire_repo_update_subpriority(struct pakfire_repo* repo) { repo->repo->subpriority = 0; } -int pakfire_repo_name_equals(struct pakfire_repo* repo, const char* name) { +int pakfire_repo_name_equals(pakfire_repo* repo, const char* name) { const char* n = pakfire_repo_get_name(repo); if (!n) return 0; @@ -186,7 +186,7 @@ int pakfire_repo_name_equals(struct pakfire_repo* repo, const char* name) { return pakfire_string_equals(n, name); } -char* pakfire_repo_url_replace(struct pakfire_repo* repo, const char* url) { +char* pakfire_repo_url_replace(pakfire_repo* repo, const char* url) { if (!url) return NULL; @@ -233,7 +233,7 @@ char* pakfire_repo_url_replace(struct pakfire_repo* repo, const char* url) { return buffer; } -int __pakfire_repo_path(struct pakfire_repo* repo, +int __pakfire_repo_path(pakfire_repo* repo, char* path, const size_t length, const char* format, ...) { char buffer[PATH_MAX]; va_list args; @@ -261,7 +261,7 @@ int __pakfire_repo_path(struct pakfire_repo* repo, return __pakfire_cache_path(repo->pakfire, path, length, "%s/%s", name, buffer); } -static int pakfire_repo_xfer_create(struct pakfire_xfer** xfer, struct pakfire_repo* repo, +static int pakfire_repo_xfer_create(struct pakfire_xfer** xfer, pakfire_repo* repo, const char* url, ...) __attribute__((format(printf, 3, 4))); /* @@ -269,7 +269,7 @@ static int pakfire_repo_xfer_create(struct pakfire_xfer** xfer, struct pakfire_r settings of this repository. */ static int pakfire_repo_xfer_create( - struct pakfire_xfer** xfer, struct pakfire_repo* repo, const char* url, ...) { + struct pakfire_xfer** xfer, pakfire_repo* repo, const char* url, ...) { pakfire_mirrorlist* mirrorlist = NULL; struct pakfire_xfer* x = NULL; const char* baseurl = NULL; @@ -313,7 +313,7 @@ ERROR: return r; } -static int pakfire_repo_import_key(struct pakfire_repo* self, const char* data) { +static int pakfire_repo_import_key(pakfire_repo* self, const char* data) { pakfire_key* key = NULL; int r; @@ -342,7 +342,7 @@ ERROR: } static int __pakfire_repo_import(pakfire_config* config, const char* section, void* data) { - struct pakfire_repo* self = NULL; + pakfire_repo* self = NULL; struct pakfire* pakfire = data; int r; @@ -442,7 +442,7 @@ int pakfire_repo_import(struct pakfire* pakfire, pakfire_config* config) { } static int pakfire_repo_to_packagelist( - struct pakfire_repo* self, pakfire_packagelist** list) { + pakfire_repo* self, pakfire_packagelist** list) { pakfire_packagelist* l = NULL; pakfire_package* pkg = NULL; Solvable* s = NULL; @@ -488,7 +488,7 @@ ERROR: return r; } -Id pakfire_repo_add_solvable(struct pakfire_repo* repo) { +Id pakfire_repo_add_solvable(pakfire_repo* repo) { Id id = repo_add_solvable(repo->repo); // Mark this repository as changed @@ -497,7 +497,7 @@ Id pakfire_repo_add_solvable(struct pakfire_repo* repo) { return id; } -int __pakfire_repo_make_path(struct pakfire_repo* self, char* path, size_t length, +int __pakfire_repo_make_path(pakfire_repo* self, char* path, size_t length, pakfire_archive* archive, pakfire_package* pkg) { const char* uuid = NULL; @@ -534,7 +534,7 @@ int __pakfire_repo_make_path(struct pakfire_repo* self, char* path, size_t lengt return -EINVAL; } -int pakfire_repo_import_archive(struct pakfire_repo* self, +int pakfire_repo_import_archive(pakfire_repo* self, pakfire_archive* archive, pakfire_package** package) { pakfire_package* pkg = NULL; char path[PATH_MAX]; @@ -585,14 +585,14 @@ CLEANUP: return r; } -pakfire_mirrorlist* pakfire_repo_get_mirrorlist(struct pakfire_repo* self) { +pakfire_mirrorlist* pakfire_repo_get_mirrorlist(pakfire_repo* self) { if (self->appdata->mirrorlist) return pakfire_mirrorlist_ref(self->appdata->mirrorlist); return NULL; } -struct pakfire_repo_scan_ctx { +typedef struct pakfire_repo_scan_ctx { // Progress pakfire_progress* progress; @@ -606,13 +606,13 @@ struct pakfire_repo_scan_ctx { // Packages pakfire_packagelist* packages; -}; +} pakfire_repo_scan_ctx; typedef int (*pakfire_repo_scan_callback)( - struct pakfire_repo* repo, struct pakfire_repo_scan_ctx* scan_ctx, FTSENT* entry); + pakfire_repo* repo, pakfire_repo_scan_ctx* scan_ctx, FTSENT* entry); -static int __pakfire_repo_scan(struct pakfire_repo* repo, - struct pakfire_repo_scan_ctx* scan_ctx, pakfire_repo_scan_callback callback) { +static int __pakfire_repo_scan(pakfire_repo* repo, + pakfire_repo_scan_ctx* scan_ctx, pakfire_repo_scan_callback callback) { FTSENT* entry = NULL; FTS* fts = NULL; int r = 0; @@ -661,15 +661,15 @@ ERROR: return r; } -static int __pakfire_repo_scan_count(struct pakfire_repo* repo, - struct pakfire_repo_scan_ctx* scan_ctx, FTSENT* entry) { +static int __pakfire_repo_scan_count(pakfire_repo* repo, + pakfire_repo_scan_ctx* scan_ctx, FTSENT* entry) { ++scan_ctx->num_archives; return 0; } -static int __pakfire_repo_scan_archive(struct pakfire_repo* repo, - struct pakfire_repo_scan_ctx* scan_ctx, FTSENT* entry) { +static int __pakfire_repo_scan_archive(pakfire_repo* repo, + pakfire_repo_scan_ctx* scan_ctx, FTSENT* entry) { pakfire_archive* archive = NULL; pakfire_package* package = NULL; int r = 0; @@ -704,11 +704,11 @@ ERROR: return r; } -int pakfire_repo_scan(struct pakfire_repo* repo, int flags) { +int pakfire_repo_scan(pakfire_repo* repo, int flags) { int r; // Scan context - struct pakfire_repo_scan_ctx scan_ctx = { + pakfire_repo_scan_ctx scan_ctx = { .flags = flags, }; @@ -800,7 +800,7 @@ static int pakfire_repo_sync_remove(pakfire_ctx* ctx, pakfire_package* pkg, void return 0; } -static int pakfire_repo_sync(struct pakfire_repo* self) { +static int pakfire_repo_sync(pakfire_repo* self) { int r; // Log action @@ -820,7 +820,7 @@ static int pakfire_repo_sync(struct pakfire_repo* self) { } static int pakfire_repo_download_database( - struct pakfire_repo* repo, const char* filename, const char* path) { + pakfire_repo* repo, const char* filename, const char* path) { struct pakfire_xfer* xfer = NULL; char title[NAME_MAX]; int r; @@ -872,8 +872,8 @@ ERROR: return r; } -static int pakfire_repo_read_database(struct pakfire_repo* self) { - struct pakfire_repomd* repomd = &self->appdata->repomd; +static int pakfire_repo_read_database(pakfire_repo* self) { + pakfire_repomd* repomd = &self->appdata->repomd; char path[PATH_MAX]; FILE* f = NULL; int r; @@ -944,12 +944,12 @@ ERROR: return r; } -static void pakfire_repo_reset_metadata(struct pakfire_repo* self) { +static void pakfire_repo_reset_metadata(pakfire_repo* self) { memset(&self->appdata->repomd, 0, sizeof(self->appdata->repomd)); } -static int pakfire_repo_parse_repomd(struct pakfire_repo* self, - struct pakfire_repomd* repomd, struct json_object* root) { +static int pakfire_repo_parse_repomd(pakfire_repo* self, + pakfire_repomd* repomd, struct json_object* root) { struct json_object* files = NULL; struct json_object* file = NULL; struct json_object* chksums = NULL; @@ -1053,7 +1053,7 @@ ERROR: return r; } -static int pakfire_repo_read_metadata(struct pakfire_repo* repo, const char* path) { +static int pakfire_repo_read_metadata(pakfire_repo* repo, const char* path) { struct json_object* json = NULL; char* error = NULL; int r; @@ -1104,7 +1104,7 @@ ERROR: return r; } -static int pakfire_repo_download_mirrorlist(struct pakfire_repo* self, +static int pakfire_repo_download_mirrorlist(pakfire_repo* self, const char* path, const int force) { struct pakfire_xfer* xfer = NULL; char* url = NULL; @@ -1157,7 +1157,7 @@ ERROR: return r; } -static int pakfire_repo_refresh_mirrorlist(struct pakfire_repo* self, const int force) { +static int pakfire_repo_refresh_mirrorlist(pakfire_repo* self, const int force) { pakfire_mirrorlist* mirrorlist = NULL; char path[PATH_MAX]; int r; @@ -1208,7 +1208,7 @@ ERROR: } static int pakfire_repo_verify_metadata( - struct pakfire_repo* self, const pakfire_buffer* repomd) { + pakfire_repo* self, const pakfire_buffer* repomd) { pakfire_buffer signature = {}; struct pakfire_xfer* xfer = NULL; FILE* f = NULL; @@ -1259,8 +1259,8 @@ ERROR: return r; } -static int pakfire_repo_download_metadata(struct pakfire_repo* repo, const char* path, int force) { - struct pakfire_repomd repomd = {}; +static int pakfire_repo_download_metadata(pakfire_repo* repo, const char* path, int force) { + pakfire_repomd repomd = {}; pakfire_buffer buffer = {}; struct pakfire_xfer* xfer = NULL; struct json_object* json = NULL; @@ -1370,7 +1370,7 @@ ERROR: return r; } -static void pakfire_repo_free_appdata(struct pakfire_repo_appdata* appdata) { +static void pakfire_repo_free_appdata(pakfire_repo_appdata* appdata) { // Don't free if something is still holding references if (--appdata->nrefs > 0) return; @@ -1385,7 +1385,7 @@ static void pakfire_repo_free_appdata(struct pakfire_repo_appdata* appdata) { free(appdata); } -static void pakfire_repo_free(struct pakfire_repo* self) { +static void pakfire_repo_free(pakfire_repo* self) { if (self->appdata) pakfire_repo_free_appdata(self->appdata); if (self->pakfire) @@ -1410,8 +1410,8 @@ void pakfire_repo_free_all(struct pakfire* pakfire) { } } -static int pakfire_repo_setup_appdata(struct pakfire_repo* self) { - struct pakfire_repo_appdata* appdata = NULL; +static int pakfire_repo_setup_appdata(pakfire_repo* self) { + pakfire_repo_appdata* appdata = NULL; // Allocate appdata appdata = calloc(1, sizeof(*appdata)); @@ -1445,9 +1445,9 @@ static int pakfire_repo_setup_appdata(struct pakfire_repo* self) { return 0; } -int pakfire_repo_create(struct pakfire_repo** repo, +int pakfire_repo_create(pakfire_repo** repo, struct pakfire* pakfire, const char* name) { - struct pakfire_repo* self = NULL; + pakfire_repo* self = NULL; int r; // Allocate some memory @@ -1506,8 +1506,8 @@ ERROR: return r; } -int pakfire_repo_open(struct pakfire_repo** repo, struct pakfire* pakfire, Repo* _repo) { - struct pakfire_repo* self = NULL; +int pakfire_repo_open(pakfire_repo** repo, struct pakfire* pakfire, Repo* _repo) { + pakfire_repo* self = NULL; // Allocate some memory self = calloc(1, sizeof(*self)); @@ -1536,13 +1536,13 @@ int pakfire_repo_open(struct pakfire_repo** repo, struct pakfire* pakfire, Repo* return 0; } -struct pakfire_repo* pakfire_repo_ref(struct pakfire_repo* repo) { +pakfire_repo* pakfire_repo_ref(pakfire_repo* repo) { repo->nrefs++; return repo; } -struct pakfire_repo* pakfire_repo_unref(struct pakfire_repo* repo) { +pakfire_repo* pakfire_repo_unref(pakfire_repo* repo) { if (--repo->nrefs > 0) return repo; @@ -1550,25 +1550,25 @@ struct pakfire_repo* pakfire_repo_unref(struct pakfire_repo* repo) { return NULL; } -int pakfire_repo_clear(struct pakfire_repo* self) { +int pakfire_repo_clear(pakfire_repo* self) { repo_empty(self->repo, 0); return 0; } -Repo* pakfire_repo_get_repo(struct pakfire_repo* repo) { +Repo* pakfire_repo_get_repo(pakfire_repo* repo) { return repo->repo; } -Repodata* pakfire_repo_get_repodata(struct pakfire_repo* repo) { +Repodata* pakfire_repo_get_repodata(pakfire_repo* repo) { return repo_last_repodata(repo->repo); } -int pakfire_repo_identical(struct pakfire_repo* repo1, struct pakfire_repo* repo2) { +int pakfire_repo_identical(pakfire_repo* repo1, pakfire_repo* repo2) { return (repo1->repo == repo2->repo); } -int pakfire_repo_cmp(struct pakfire_repo* repo1, struct pakfire_repo* repo2) { +int pakfire_repo_cmp(pakfire_repo* repo1, pakfire_repo* repo2) { Repo* r1 = repo1->repo; Repo* r2 = repo2->repo; @@ -1581,7 +1581,7 @@ int pakfire_repo_cmp(struct pakfire_repo* repo1, struct pakfire_repo* repo2) { return pakfire_string_equals(r1->name, r2->name); } -int pakfire_repo_count(struct pakfire_repo* repo) { +int pakfire_repo_count(pakfire_repo* repo) { Pool* pool = pakfire_get_solv_pool(repo->pakfire); int cnt = 0; @@ -1594,14 +1594,14 @@ int pakfire_repo_count(struct pakfire_repo* repo) { return cnt; } -void pakfire_repo_has_changed(struct pakfire_repo* repo) { +void pakfire_repo_has_changed(pakfire_repo* repo) { repo->appdata->ready = 0; // Mark pool as changed, too pakfire_pool_has_changed(repo->pakfire); } -int pakfire_repo_internalize(struct pakfire_repo* repo, int flags) { +int pakfire_repo_internalize(pakfire_repo* repo, int flags) { if (repo->appdata->ready) return 0; @@ -1614,41 +1614,41 @@ int pakfire_repo_internalize(struct pakfire_repo* repo, int flags) { return 0; } -const char* pakfire_repo_get_name(struct pakfire_repo* repo) { +const char* pakfire_repo_get_name(pakfire_repo* repo) { return repo->repo->name; } -const char* pakfire_repo_get_description(struct pakfire_repo* repo) { +const char* pakfire_repo_get_description(pakfire_repo* repo) { return repo->appdata->description; } -int pakfire_repo_set_description(struct pakfire_repo* repo, const char* description) { +int pakfire_repo_set_description(pakfire_repo* repo, const char* description) { return pakfire_string_set(repo->appdata->description, description); } -int pakfire_repo_get_enabled(struct pakfire_repo* repo) { +int pakfire_repo_get_enabled(pakfire_repo* repo) { return !repo->repo->disabled; } -void pakfire_repo_set_enabled(struct pakfire_repo* repo, int enabled) { +void pakfire_repo_set_enabled(pakfire_repo* repo, int enabled) { repo->repo->disabled = !enabled; pakfire_repo_has_changed(repo); } -int pakfire_repo_get_priority(struct pakfire_repo* repo) { +int pakfire_repo_get_priority(pakfire_repo* repo) { return repo->repo->priority; } -void pakfire_repo_set_priority(struct pakfire_repo* repo, int priority) { +void pakfire_repo_set_priority(pakfire_repo* repo, int priority) { repo->repo->priority = priority; } -const char* pakfire_repo_get_baseurl(struct pakfire_repo* repo) { +const char* pakfire_repo_get_baseurl(pakfire_repo* repo) { return repo->appdata->baseurl; } -static const char* pakfire_repo_get_expanded_baseurl(struct pakfire_repo* repo) { +static const char* pakfire_repo_get_expanded_baseurl(pakfire_repo* repo) { char* url = NULL; int r; @@ -1674,7 +1674,7 @@ ERROR: return (*repo->appdata->expanded_baseurl) ? repo->appdata->expanded_baseurl : NULL; } -int pakfire_repo_set_baseurl(struct pakfire_repo* repo, const char* baseurl) { +int pakfire_repo_set_baseurl(pakfire_repo* repo, const char* baseurl) { int r; // Store the URL @@ -1691,7 +1691,7 @@ int pakfire_repo_set_baseurl(struct pakfire_repo* repo, const char* baseurl) { return 0; } -const char* pakfire_repo_get_path(struct pakfire_repo* repo) { +const char* pakfire_repo_get_path(pakfire_repo* repo) { const char* baseurl = NULL; if (!pakfire_repo_is_local(repo)) @@ -1711,25 +1711,25 @@ const char* pakfire_repo_get_path(struct pakfire_repo* repo) { return baseurl + strlen("file://"); } -pakfire_key* pakfire_repo_get_key(struct pakfire_repo* self) { +pakfire_key* pakfire_repo_get_key(pakfire_repo* self) { if (self->appdata->key) return pakfire_key_ref(self->appdata->key); return NULL; } -const char* pakfire_repo_get_mirrorlist_url(struct pakfire_repo* self) { +const char* pakfire_repo_get_mirrorlist_url(pakfire_repo* self) { if (*self->appdata->mirrorlist_url) return self->appdata->mirrorlist_url; return NULL; } -int pakfire_repo_set_mirrorlist_url(struct pakfire_repo* repo, const char* url) { +int pakfire_repo_set_mirrorlist_url(pakfire_repo* repo, const char* url) { return pakfire_string_set(repo->appdata->mirrorlist_url, url); } -int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f) { +int pakfire_repo_write_config(pakfire_repo* repo, FILE* f) { pakfire_config* config = NULL; pakfire_key* key = NULL; char* section = NULL; @@ -1847,12 +1847,12 @@ ERROR: return r; } -int pakfire_repo_is_installed_repo(struct pakfire_repo* self) { +int pakfire_repo_is_installed_repo(pakfire_repo* self) { return (self->repo == self->repo->pool->installed); } int pakfire_repo_download_package(struct pakfire_xfer** xfer, - struct pakfire_repo* repo, pakfire_package* pkg) { + pakfire_repo* repo, pakfire_package* pkg) { enum pakfire_hash_type hash = PAKFIRE_HASH_UNDEFINED; const unsigned char* checksum = NULL; size_t checksum_length = 0; @@ -1942,7 +1942,7 @@ ERROR: return r; } -static int pakfire_repo_download(struct pakfire_repo* repo, const char* url, +static int pakfire_repo_download(pakfire_repo* repo, const char* url, pakfire_package** package) { struct pakfire_xfer* xfer = NULL; FILE* f = NULL; @@ -1989,7 +1989,7 @@ ERROR: return r; } -int pakfire_repo_add(struct pakfire_repo* repo, const char* path, +int pakfire_repo_add(pakfire_repo* repo, const char* path, pakfire_package** package) { pakfire_archive* archive = NULL; int r; @@ -2024,7 +2024,7 @@ ERROR: return r; } -int pakfire_repo_read_solv(struct pakfire_repo* repo, FILE *f, int flags) { +int pakfire_repo_read_solv(pakfire_repo* repo, FILE *f, int flags) { int r; // Import SOLV data @@ -2058,7 +2058,7 @@ int pakfire_repo_read_solv(struct pakfire_repo* repo, FILE *f, int flags) { return 0; } -int pakfire_repo_write_solv(struct pakfire_repo* repo, FILE *f, int flags) { +int pakfire_repo_write_solv(pakfire_repo* repo, FILE *f, int flags) { Repodata* meta = NULL; Queue addedfileprovides; int r; @@ -2117,7 +2117,7 @@ ERROR: } static int pakfire_repo_delete_all_packages( - struct pakfire_repo* repo, const char* prefix) { + pakfire_repo* repo, const char* prefix) { pakfire_package* pkg = NULL; Solvable* s = NULL; int i = 0; @@ -2155,7 +2155,7 @@ NEXT: return 0; } -int pakfire_repo_clean(struct pakfire_repo* repo, int flags) { +int pakfire_repo_clean(pakfire_repo* repo, int flags) { char cache_path[PATH_MAX]; int r; @@ -2199,7 +2199,7 @@ int pakfire_repo_clean(struct pakfire_repo* repo, int flags) { return pakfire_rmtree(cache_path, 0); } -int pakfire_repo_refresh(struct pakfire_repo* repo, int force) { +int pakfire_repo_refresh(pakfire_repo* repo, int force) { char path[PATH_MAX]; int r; @@ -2249,7 +2249,7 @@ int pakfire_repo_refresh(struct pakfire_repo* repo, int force) { return 0; } -static int pakfire_repo_cleanup_metadata(struct pakfire_repo* self) { +static int pakfire_repo_cleanup_metadata(pakfire_repo* self) { char path[PATH_MAX]; int r; @@ -2266,7 +2266,7 @@ static int pakfire_repo_cleanup_metadata(struct pakfire_repo* self) { return pakfire_rmtree(path, 0); } -static int pakfire_repo_metadata_add_file(struct pakfire_repo* self, +static int pakfire_repo_metadata_add_file(pakfire_repo* self, struct json_object* repomd, const char* type, const char* path) { enum pakfire_hash_type hash = PAKFIRE_HASH_UNDEFINED; struct pakfire_hashes checksums = {}; @@ -2366,7 +2366,7 @@ ERROR: return r; } -static int pakfire_repo_write_database(struct pakfire_repo* self, struct json_object* repomd) { +static int pakfire_repo_write_database(pakfire_repo* self, struct json_object* repomd) { char filename[PATH_MAX]; char path[PATH_MAX]; char tmp[PATH_MAX]; @@ -2439,7 +2439,7 @@ ERROR: return r; } -static int pakfire_repo_make_metadata(struct pakfire_repo* self, struct json_object* md) { +static int pakfire_repo_make_metadata(pakfire_repo* self, struct json_object* md) { int r; // Set the version @@ -2462,7 +2462,7 @@ static int pakfire_repo_make_metadata(struct pakfire_repo* self, struct json_obj return 0; } -int pakfire_repo_write_metadata(struct pakfire_repo* self, pakfire_key* key) { +int pakfire_repo_write_metadata(pakfire_repo* self, pakfire_key* key) { struct json_object* repomd = NULL; char repomd_path[PATH_MAX]; char sigpath[PATH_MAX]; @@ -2555,7 +2555,7 @@ ERROR: int pakfire_repo_compose(struct pakfire* pakfire, const char* path, pakfire_key* key, const char** files) { pakfire_archive* archive = NULL; - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; char realpath[PATH_MAX]; char baseurl[PATH_MAX]; int r; @@ -2664,7 +2664,7 @@ ERROR: return r; } -int pakfire_repo_walk_packages(struct pakfire_repo* self, +int pakfire_repo_walk_packages(pakfire_repo* self, int (*callback)(pakfire_ctx* ctx, pakfire_package* pkg, void* data), void* data, int flags) { pakfire_packagelist* list = NULL; int r; @@ -2686,14 +2686,14 @@ ERROR: return r; } -struct pakfire_repo_walk_archives_state { +typedef struct pakfire_repo_walk_archives_state { pakfire_repo_walk_archives_callback callback; void* data; -}; +} pakfire_repo_walk_archives_state; static int __pakfire_repo_walk_archives( pakfire_ctx* ctx, pakfire_package* pkg, void* data) { - const struct pakfire_repo_walk_archives_state* state = data; + const pakfire_repo_walk_archives_state* state = data; pakfire_archive* archive = NULL; int r; @@ -2715,12 +2715,12 @@ static int __pakfire_repo_walk_archives( return r; } -int pakfire_repo_walk_archives(struct pakfire_repo* self, +int pakfire_repo_walk_archives(pakfire_repo* self, pakfire_repo_walk_archives_callback callback, void* data, int flags) { pakfire_packagelist* list = NULL; int r; - struct pakfire_repo_walk_archives_state state = { + pakfire_repo_walk_archives_state state = { .callback = callback, .data = data, }; diff --git a/src/pakfire/repo.h b/src/pakfire/repo.h index 6a012ea6..bff2e8ec 100644 --- a/src/pakfire/repo.h +++ b/src/pakfire/repo.h @@ -27,7 +27,7 @@ #include -struct pakfire_repo; +typedef struct pakfire_repo pakfire_repo; #include #include @@ -39,51 +39,51 @@ struct pakfire_repo; #include #include -int pakfire_repo_create(struct pakfire_repo** repo, struct pakfire* pakfire, const char* name); -int pakfire_repo_open(struct pakfire_repo** repo, struct pakfire* pakfire, Repo* _repo); +int pakfire_repo_create(pakfire_repo** repo, struct pakfire* pakfire, const char* name); +int pakfire_repo_open(pakfire_repo** repo, struct pakfire* pakfire, Repo* _repo); -struct pakfire_repo* pakfire_repo_ref(struct pakfire_repo* repo); -struct pakfire_repo* pakfire_repo_unref(struct pakfire_repo* repo); +pakfire_repo* pakfire_repo_ref(pakfire_repo* repo); +pakfire_repo* pakfire_repo_unref(pakfire_repo* repo); -int pakfire_repo_clear(struct pakfire_repo* repo); +int pakfire_repo_clear(pakfire_repo* repo); -int pakfire_repo_identical(struct pakfire_repo* repo1, struct pakfire_repo* repo2); -int pakfire_repo_cmp(struct pakfire_repo* repo1, struct pakfire_repo* repo2); -int pakfire_repo_count(struct pakfire_repo* repo); +int pakfire_repo_identical(pakfire_repo* repo1, pakfire_repo* repo2); +int pakfire_repo_cmp(pakfire_repo* repo1, pakfire_repo* repo2); +int pakfire_repo_count(pakfire_repo* repo); -const char* pakfire_repo_get_name(struct pakfire_repo* repo); +const char* pakfire_repo_get_name(pakfire_repo* repo); -const char* pakfire_repo_get_description(struct pakfire_repo* repo); -int pakfire_repo_set_description(struct pakfire_repo* repo, const char* description); +const char* pakfire_repo_get_description(pakfire_repo* repo); +int pakfire_repo_set_description(pakfire_repo* repo, const char* description); -int pakfire_repo_get_enabled(struct pakfire_repo* repo); -void pakfire_repo_set_enabled(struct pakfire_repo* repo, int enabled); +int pakfire_repo_get_enabled(pakfire_repo* repo); +void pakfire_repo_set_enabled(pakfire_repo* repo, int enabled); -int pakfire_repo_get_priority(struct pakfire_repo* repo); -void pakfire_repo_set_priority(struct pakfire_repo* repo, int priority); +int pakfire_repo_get_priority(pakfire_repo* repo); +void pakfire_repo_set_priority(pakfire_repo* repo, int priority); -const char* pakfire_repo_get_baseurl(struct pakfire_repo* repo); -int pakfire_repo_set_baseurl(struct pakfire_repo* repo, const char* baseurl); +const char* pakfire_repo_get_baseurl(pakfire_repo* repo); +int pakfire_repo_set_baseurl(pakfire_repo* repo, const char* baseurl); -pakfire_key* pakfire_repo_get_key(struct pakfire_repo* repo); +pakfire_key* pakfire_repo_get_key(pakfire_repo* repo); -const char* pakfire_repo_get_mirrorlist_url(struct pakfire_repo* repo); -int pakfire_repo_set_mirrorlist_url(struct pakfire_repo* repo, const char* url); +const char* pakfire_repo_get_mirrorlist_url(pakfire_repo* repo); +int pakfire_repo_set_mirrorlist_url(pakfire_repo* repo, const char* url); -pakfire_mirrorlist* pakfire_repo_get_mirrors(struct pakfire_repo* repo); +pakfire_mirrorlist* pakfire_repo_get_mirrors(pakfire_repo* repo); #define pakfire_repo_path(repo, path, format, ...) \ __pakfire_repo_path(repo, path, sizeof(path), format, __VA_ARGS__) -int __pakfire_repo_path(struct pakfire_repo* repo, +int __pakfire_repo_path(pakfire_repo* repo, char* path, const size_t length, const char* format, ...) __attribute__((format(printf, 4, 5))); -int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f); +int pakfire_repo_write_config(pakfire_repo* repo, FILE* f); -int pakfire_repo_is_installed_repo(struct pakfire_repo* repo); +int pakfire_repo_is_installed_repo(pakfire_repo* repo); -int pakfire_repo_read_solv(struct pakfire_repo* repo, FILE *f, int flags); -int pakfire_repo_write_solv(struct pakfire_repo* repo, FILE *f, int flags); +int pakfire_repo_read_solv(pakfire_repo* repo, FILE *f, int flags); +int pakfire_repo_write_solv(pakfire_repo* repo, FILE *f, int flags); // Cache @@ -92,19 +92,19 @@ enum pakfire_repo_clean_flags { PAKFIRE_REPO_CLEAN_FLAGS_DESTROY = (1 << 0), }; -int pakfire_repo_clean(struct pakfire_repo* repo, int flags); +int pakfire_repo_clean(pakfire_repo* repo, int flags); // Scan -int pakfire_repo_scan(struct pakfire_repo* repo, int flags); +int pakfire_repo_scan(pakfire_repo* repo, int flags); // Refresh -int pakfire_repo_refresh(struct pakfire_repo* repo, int force); +int pakfire_repo_refresh(pakfire_repo* repo, int force); // Compose -int pakfire_repo_write_metadata(struct pakfire_repo* repo, pakfire_key* key); +int pakfire_repo_write_metadata(pakfire_repo* repo, pakfire_key* key); int pakfire_repo_compose(struct pakfire* pakfire, const char* path, pakfire_key* key, const char** files); @@ -115,47 +115,47 @@ int pakfire_repo_compose(struct pakfire* pakfire, const char* path, #define PAKFIRE_REPO_RESULT "@build" #define PAKFIRE_REPO_SYSTEM "@system" -int pakfire_repo_name_equals(struct pakfire_repo* repo, const char* name); -int pakfire_repo_is_internal(struct pakfire_repo* repo); -int pakfire_repo_is_local(struct pakfire_repo* repo); +int pakfire_repo_name_equals(pakfire_repo* repo, const char* name); +int pakfire_repo_is_internal(pakfire_repo* repo); +int pakfire_repo_is_local(pakfire_repo* repo); -char* pakfire_repo_url_replace(struct pakfire_repo* repo, const char* url); +char* pakfire_repo_url_replace(pakfire_repo* repo, const char* url); int pakfire_repo_import(struct pakfire* pakfire, pakfire_config* config); -const char* pakfire_repo_get_path(struct pakfire_repo* repo); +const char* pakfire_repo_get_path(pakfire_repo* repo); -void pakfire_repo_has_changed(struct pakfire_repo* repo); -int pakfire_repo_internalize(struct pakfire_repo* repo, int flags); -Id pakfire_repo_add_solvable(struct pakfire_repo* repo); +void pakfire_repo_has_changed(pakfire_repo* repo); +int pakfire_repo_internalize(pakfire_repo* repo, int flags); +Id pakfire_repo_add_solvable(pakfire_repo* repo); #define pakfire_repo_make_path(repo, path, archive, pkg) \ __pakfire_repo_make_path(repo, path, sizeof(path), archive, pkg) -int __pakfire_repo_make_path(struct pakfire_repo* self, +int __pakfire_repo_make_path(pakfire_repo* self, char* path, size_t length, pakfire_archive* archive, pakfire_package* pkg); -int pakfire_repo_import_archive(struct pakfire_repo* self, +int pakfire_repo_import_archive(pakfire_repo* self, pakfire_archive* archive, pakfire_package** package); int pakfire_repo_download_package(struct pakfire_xfer** xfer, - struct pakfire_repo* repo, pakfire_package* pkg); + pakfire_repo* repo, pakfire_package* pkg); -int pakfire_repo_add(struct pakfire_repo* repo, const char* path, +int pakfire_repo_add(pakfire_repo* repo, const char* path, pakfire_package** package); void pakfire_repo_free_all(struct pakfire* pakfire); -Repo* pakfire_repo_get_repo(struct pakfire_repo* repo); -Repodata* pakfire_repo_get_repodata(struct pakfire_repo* repo); +Repo* pakfire_repo_get_repo(pakfire_repo* repo); +Repodata* pakfire_repo_get_repodata(pakfire_repo* repo); -pakfire_mirrorlist* pakfire_repo_get_mirrorlist(struct pakfire_repo* repo); +pakfire_mirrorlist* pakfire_repo_get_mirrorlist(pakfire_repo* repo); -int pakfire_repo_walk_packages(struct pakfire_repo* self, +int pakfire_repo_walk_packages(pakfire_repo* self, int (*callback)(pakfire_ctx* ctx, pakfire_package* pkg, void* data), void* data, int flags); typedef int (*pakfire_repo_walk_archives_callback) (pakfire_ctx* ctx, pakfire_package* pkg, pakfire_archive* archive, void* data); -int pakfire_repo_walk_archives(struct pakfire_repo* self, +int pakfire_repo_walk_archives(pakfire_repo* self, pakfire_repo_walk_archives_callback callback, void* data, int flags); #endif /* PAKFIRE_REPO_H */ diff --git a/src/pakfire/repolist.c b/src/pakfire/repolist.c index 0d3b4183..9013ea91 100644 --- a/src/pakfire/repolist.c +++ b/src/pakfire/repolist.c @@ -27,14 +27,14 @@ struct pakfire_repolist { int nrefs; - struct pakfire_repo** elements; + pakfire_repo** elements; size_t elements_size; size_t size; }; static int pakfire_repolist_grow(pakfire_repolist* list, size_t size) { - struct pakfire_repo** elements = reallocarray(list->elements, + pakfire_repo** elements = reallocarray(list->elements, list->elements_size + size, sizeof(*list->elements)); if (!elements) return -errno; @@ -99,14 +99,14 @@ int pakfire_repolist_empty(pakfire_repolist* list) { return list->size == 0; } -struct pakfire_repo* pakfire_repolist_get(pakfire_repolist* list, size_t index) { +pakfire_repo* pakfire_repolist_get(pakfire_repolist* list, size_t index) { if (index >= list->size) return NULL; return pakfire_repo_ref(list->elements[index]); } -int pakfire_repolist_append(pakfire_repolist* list, struct pakfire_repo* repo) { +int pakfire_repolist_append(pakfire_repolist* list, pakfire_repo* repo) { if (!repo) return EINVAL; diff --git a/src/pakfire/repolist.h b/src/pakfire/repolist.h index 50b4684a..f0af1332 100644 --- a/src/pakfire/repolist.h +++ b/src/pakfire/repolist.h @@ -35,7 +35,7 @@ void pakfire_repolist_clear(pakfire_repolist* list); size_t pakfire_repolist_size(pakfire_repolist* list); int pakfire_repolist_empty(pakfire_repolist* list); -struct pakfire_repo* pakfire_repolist_get(pakfire_repolist* list, size_t index); -int pakfire_repolist_append(pakfire_repolist* list, struct pakfire_repo* repo); +pakfire_repo* pakfire_repolist_get(pakfire_repolist* list, size_t index); +int pakfire_repolist_append(pakfire_repolist* list, pakfire_repo* repo); #endif /* PAKFIRE_REPOLIST_H */ diff --git a/src/pakfire/transaction.c b/src/pakfire/transaction.c index f8dd4ece..1955d017 100644 --- a/src/pakfire/transaction.c +++ b/src/pakfire/transaction.c @@ -936,7 +936,7 @@ static int pakfire_transaction_add_package(char** s, size_t width, pakfire_packa char size[128]; int r; - struct pakfire_repo* repo = pakfire_package_get_repo(pkg); + pakfire_repo* repo = pakfire_package_get_repo(pkg); // Format size r = pakfire_format_size(size, pakfire_package_get_size(pkg)); @@ -1845,7 +1845,7 @@ static int pakfire_usrmove(pakfire_ctx* ctx, struct pakfire* pakfire) { } static int pakfire_transaction_perform(struct pakfire_transaction* transaction) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; pakfire_db* db; size_t total_size = 0; int r; @@ -1924,7 +1924,7 @@ ERROR: static int pakfire_transaction_download_package(struct pakfire_transaction* transaction, pakfire_httpclient* httpclient, pakfire_package* pkg) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; struct pakfire_xfer* xfer = NULL; int r; diff --git a/src/python/package.c b/src/python/package.c index e566b1d2..dc09566a 100644 --- a/src/python/package.c +++ b/src/python/package.c @@ -334,7 +334,7 @@ static PyObject* Package_get_buildtime(PackageObject* self) { } static PyObject* Package_get_repo(PackageObject* self) { - struct pakfire_repo* repo = pakfire_package_get_repo(self->package); + pakfire_repo* repo = pakfire_package_get_repo(self->package); if (!repo) Py_RETURN_NONE; diff --git a/src/python/pakfire.c b/src/python/pakfire.c index 5295b913..92435be5 100644 --- a/src/python/pakfire.c +++ b/src/python/pakfire.c @@ -158,7 +158,7 @@ static PyObject* Pakfire_get_repo(PakfireObject* self, PyObject* args) { if (!PyArg_ParseTuple(args, "s", &name)) return NULL; - struct pakfire_repo* repo = pakfire_get_repo(self->pakfire, name); + pakfire_repo* repo = pakfire_get_repo(self->pakfire, name); if (!repo) Py_RETURN_NONE; @@ -401,7 +401,7 @@ static PyObject* Pakfire_get_repos(PakfireObject* self) { goto ERROR; for (unsigned int i = 0; i < l; i++) { - struct pakfire_repo* repo = pakfire_repolist_get(repos, i); + pakfire_repo* repo = pakfire_repolist_get(repos, i); if (!repo) continue; diff --git a/src/python/repo.c b/src/python/repo.c index f4825714..5383c137 100644 --- a/src/python/repo.c +++ b/src/python/repo.c @@ -30,7 +30,7 @@ #include "package.h" #include "repo.h" -PyObject* new_repo(PyTypeObject* type, struct pakfire_repo* repo) { +PyObject* new_repo(PyTypeObject* type, pakfire_repo* repo) { RepoObject* self = (RepoObject *)type->tp_alloc(type, 0); if (self) { self->repo = pakfire_repo_ref(repo); diff --git a/src/python/repo.h b/src/python/repo.h index d6b6e0ed..161cbb8e 100644 --- a/src/python/repo.h +++ b/src/python/repo.h @@ -29,12 +29,12 @@ typedef struct { PyObject_HEAD - struct pakfire_repo* repo; + pakfire_repo* repo; int clean; } RepoObject; extern PyTypeObject RepoType; -PyObject* new_repo(PyTypeObject* type, struct pakfire_repo* repo); +PyObject* new_repo(PyTypeObject* type, pakfire_repo* repo); #endif /* PYTHON_PAKFIRE_REPO_H */ diff --git a/tests/libpakfire/archive.c b/tests/libpakfire/archive.c index e2604eae..39b51830 100644 --- a/tests/libpakfire/archive.c +++ b/tests/libpakfire/archive.c @@ -216,7 +216,7 @@ static int test_import(const struct test* t) { int r = EXIT_FAILURE; pakfire_archive* archive = NULL; - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; pakfire_package* package = NULL; // Open archive diff --git a/tests/libpakfire/db.c b/tests/libpakfire/db.c index c5d996d8..545d71c2 100644 --- a/tests/libpakfire/db.c +++ b/tests/libpakfire/db.c @@ -80,7 +80,7 @@ FAIL: static int test_add_package(const struct test* t) { pakfire_package* package = NULL; pakfire_db* db = NULL; - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; pakfire_archive* archive = NULL; int r = EXIT_FAILURE; diff --git a/tests/libpakfire/makefile.c b/tests/libpakfire/makefile.c index d1359aae..32a3b642 100644 --- a/tests/libpakfire/makefile.c +++ b/tests/libpakfire/makefile.c @@ -114,7 +114,7 @@ FAIL: static int test_packages(const struct test* t) { pakfire_parser* parser = NULL; pakfire_package* pkg = NULL; - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; char* s = NULL; int r = EXIT_FAILURE; diff --git a/tests/libpakfire/packager.c b/tests/libpakfire/packager.c index 0ffeb85e..3fcc5598 100644 --- a/tests/libpakfire/packager.c +++ b/tests/libpakfire/packager.c @@ -30,7 +30,7 @@ static int test_create(const struct test* t) { pakfire_packager* packager = NULL; pakfire_package* pkg = NULL; - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; int r = EXIT_FAILURE; ASSERT_SUCCESS(pakfire_repo_create(&repo, t->pakfire, "test")); @@ -74,7 +74,7 @@ static int test_compare_metadata(const struct test* t) { int r = EXIT_FAILURE; // Fetch the dummy repository - struct pakfire_repo* repo = pakfire_get_repo(t->pakfire, PAKFIRE_REPO_DUMMY); + pakfire_repo* repo = pakfire_get_repo(t->pakfire, PAKFIRE_REPO_DUMMY); ASSERT(repo); ASSERT_SUCCESS(pakfire_package_create(&pkg1, t->pakfire, repo, diff --git a/tests/libpakfire/repo.c b/tests/libpakfire/repo.c index d1ae95a3..25b3c894 100644 --- a/tests/libpakfire/repo.c +++ b/tests/libpakfire/repo.c @@ -27,7 +27,7 @@ #define TEST_PKG1_PATH "data/beep-1.3-2.ip3.x86_64.pfm" static int test_scan(const struct test* t) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; char baseurl[1024]; int r = EXIT_FAILURE; FILE* f = NULL; @@ -76,7 +76,7 @@ FAIL: } static int test_compose(const struct test* t) { - struct pakfire_repo* repo = NULL; + pakfire_repo* repo = NULL; int r = EXIT_FAILURE; // Create a temporary working directory