From: Michael Tremer Date: Sat, 11 Jan 2025 17:37:01 +0000 (+0000) Subject: archive: Allow creating a package without returning it X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b99ae9c6953e29d2a7008188ad67ede4310a2f7e;p=people%2Fric9%2Fpakfire.git archive: Allow creating a package without returning it This is useful when we simply want to add the package to a repository. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/archive.c b/src/pakfire/archive.c index 8a6438127..07120fef6 100644 --- a/src/pakfire/archive.c +++ b/src/pakfire/archive.c @@ -1762,11 +1762,17 @@ static int pakfire_archive_make_package_from_json(struct pakfire_archive* archiv if (r) goto ERROR; + // Return the package (if requested) + if (package) + *package = pakfire_package_ref(pkg); + // Success! - *package = pkg; r = 0; ERROR: + if (pkg) + pakfire_package_unref(pkg); + return r; } @@ -1778,10 +1784,6 @@ int pakfire_archive_make_package(struct pakfire_archive* archive, struct pakfire_repo* dummy = NULL; int r; - // Check inputs - if (!package) - return -EINVAL; - // Use dummy repo if no repository was passed if (!repo) { dummy = pakfire_get_repo(archive->pakfire, PAKFIRE_REPO_DUMMY);