]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
problem: Directly pass the context
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Jun 2025 14:00:25 +0000 (14:00 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Jun 2025 14:00:53 +0000 (14:00 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/problem.c
src/pakfire/problem.h
src/pakfire/transaction.c

index 45490f154e389618dc4cc87a45c6beafd9f28cdf..a723e87d7d4e12dceafe85123cc88a6e00d9ac7c 100644 (file)
@@ -191,7 +191,7 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 }
 
 int pakfire_problem_create(pakfire_problem** problem,
-               pakfire_root* root, pakfire_transaction* transaction, Id id) {
+               pakfire_ctx* ctx, pakfire_root* root, pakfire_transaction* transaction, Id id) {
        pakfire_problem* p = NULL;
 
        // Allocate some memory
@@ -200,7 +200,7 @@ int pakfire_problem_create(pakfire_problem** problem,
                return -errno;
 
        // Store a reference to the context
-       p->ctx = pakfire_root_get_ctx(root);
+       p->ctx = pakfire_ctx_ref(ctx);
 
        // Store a reference to the root
        p->root = pakfire_root_ref(root);
index f98e36b4d52785602bdee3b929ba6ea34e53f9e1..a6ca7bd9cc52a049da9c1715f07d9107483816c9 100644 (file)
 
 typedef struct pakfire_problem pakfire_problem;
 
+#include <pakfire/ctx.h>
 #include <pakfire/solution.h>
 #include <pakfire/transaction.h>
 
+int pakfire_problem_create(pakfire_problem** problem,
+       pakfire_ctx* ctx, pakfire_root* root, pakfire_transaction* transaction, Id id);
+
 pakfire_problem* pakfire_problem_ref(pakfire_problem* problem);
 pakfire_problem* pakfire_problem_unref(pakfire_problem* problem);
 
@@ -37,9 +41,6 @@ const char* pakfire_problem_to_string(pakfire_problem* problem);
 pakfire_solution** pakfire_problem_get_solutions(
        pakfire_problem* problem);
 
-int pakfire_problem_create(pakfire_problem** problem, pakfire_root* root,
-       pakfire_transaction* transaction, Id id);
-
 pakfire_transaction* pakfire_problem_get_transaction(pakfire_problem* problem);
 
 Id pakfire_problem_get_id(pakfire_problem* problem);
index f6d7e3198842f44288a2fcb720786372b7637df4..d40d0ccd19d983381b034494f8c332e48f08669f 100644 (file)
@@ -464,7 +464,8 @@ pakfire_problem** pakfire_transaction_get_problems(
                        break;
 
                // Create a new problem
-               r = pakfire_problem_create(&problem, transaction->root, transaction, id);
+               r = pakfire_problem_create(&problem,
+                               transaction->ctx, transaction->root, transaction, id);
                if (r)
                        goto ERROR;