From 2526d650b407c72198ccc3d49b6168215f9b8e3c Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 29 Jun 2025 14:00:25 +0000 Subject: [PATCH] problem: Directly pass the context Signed-off-by: Michael Tremer --- src/pakfire/problem.c | 4 ++-- src/pakfire/problem.h | 7 ++++--- src/pakfire/transaction.c | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pakfire/problem.c b/src/pakfire/problem.c index 45490f15..a723e87d 100644 --- a/src/pakfire/problem.c +++ b/src/pakfire/problem.c @@ -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); diff --git a/src/pakfire/problem.h b/src/pakfire/problem.h index f98e36b4..a6ca7bd9 100644 --- a/src/pakfire/problem.h +++ b/src/pakfire/problem.h @@ -26,9 +26,13 @@ typedef struct pakfire_problem pakfire_problem; +#include #include #include +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); diff --git a/src/pakfire/transaction.c b/src/pakfire/transaction.c index f6d7e319..d40d0ccd 100644 --- a/src/pakfire/transaction.c +++ b/src/pakfire/transaction.c @@ -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; -- 2.47.2