]> git.ipfire.org Git - pakfire.git/commitdiff
problem: --> self
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Jun 2025 14:49:26 +0000 (14:49 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 29 Jun 2025 14:49:26 +0000 (14:49 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/problem.c

index a723e87d7d4e12dceafe85123cc88a6e00d9ac7c..fe4f50d1018214fc6704247c3b1dd2b5a312b730 100644 (file)
@@ -44,12 +44,12 @@ struct pakfire_problem {
        Solver* solver;
 };
 
-static char* pakfire_problem_make_string(pakfire_problem* problem) {
-       Solver* solver = pakfire_transaction_get_solver(problem->transaction);
+static char* pakfire_problem_make_string(pakfire_problem* self) {
+       Solver* solver = pakfire_transaction_get_solver(self->transaction);
        Pool* pool = solver->pool;
 
        // Get the problem rule
-       Id rule = solver_findproblemrule(solver, problem->id);
+       Id rule = solver_findproblemrule(solver, self->id);
 
        // Extract some information about that rule
        Id dep;
@@ -87,17 +87,17 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 
                case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP:
                        r = asprintf(&s, _("nothing provides requested %s"),
-                               pakfire_dep2str(problem->root, dep));
+                               pakfire_dep2str(self->root, dep));
                        break;
 
                case SOLVER_RULE_JOB_UNKNOWN_PACKAGE:
                        r = asprintf(&s, _("package %s does not exist"),
-                               pakfire_dep2str(problem->root, dep));
+                               pakfire_dep2str(self->root, dep));
                        break;
 
                case SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM:
                        r = asprintf(&s, _("%s is provided by the system"),
-                               pakfire_dep2str(problem->root, dep));
+                               pakfire_dep2str(self->root, dep));
                        break;
 
                case SOLVER_RULE_RPM:
@@ -119,7 +119,7 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 
                case SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP:
                        r = asprintf(&s, _("nothing provides %s needed by %s"),
-                               pakfire_dep2str(problem->root, dep), pool_solvid2str(pool, source));
+                               pakfire_dep2str(self->root, dep), pool_solvid2str(pool, source));
                        break;
 
                case SOLVER_RULE_RPM_SAME_NAME:
@@ -129,42 +129,42 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 
                case SOLVER_RULE_RPM_PACKAGE_CONFLICT:
                        r = asprintf(&s, _("package %s conflicts with %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(self->root, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_PACKAGE_OBSOLETES:
                        r = asprintf(&s, _("package %s obsoletes %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(self->root, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES:
                        r = asprintf(&s, _("installed package %s obsoletes %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(self->root, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_IMPLICIT_OBSOLETES:
                        r = asprintf(&s, _("package %s implicitely obsoletes %s provided by %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(self->root, dep),
                                pool_solvid2str(pool, target));
                        break;
 
                case SOLVER_RULE_RPM_PACKAGE_REQUIRES:
                        r = asprintf(&s, _("package %s requires %s, but none of the providers can be installed"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep));
+                               pool_solvid2str(pool, source), pakfire_dep2str(self->root, dep));
                        break;
 
                case SOLVER_RULE_RPM_SELF_CONFLICT:
                        r = asprintf(&s, _("package %s conflicts with %s provided by itself"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep));
+                               pool_solvid2str(pool, source), pakfire_dep2str(self->root, dep));
                        break;
 
                case SOLVER_RULE_YUMOBS:
                        r = asprintf(&s, _("both package %s and %s obsolete %s"),
                                pool_solvid2str(pool, source), pool_solvid2str(pool, target),
-                               pakfire_dep2str(problem->root, dep));
+                               pakfire_dep2str(self->root, dep));
                        break;
 
                case SOLVER_RULE_BLACK:
@@ -174,7 +174,7 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 
                case SOLVER_RULE_PKG_CONSTRAINS:
                        r = asprintf(&s, _("package %s has constraint %s conflicting with %s"),
-                               pool_solvid2str(pool, source), pakfire_dep2str(problem->root, dep),
+                               pool_solvid2str(pool, source), pakfire_dep2str(self->root, dep),
                                pool_solvid2str(pool, target));
                        break;
 
@@ -192,80 +192,79 @@ static char* pakfire_problem_make_string(pakfire_problem* problem) {
 
 int pakfire_problem_create(pakfire_problem** problem,
                pakfire_ctx* ctx, pakfire_root* root, pakfire_transaction* transaction, Id id) {
-       pakfire_problem* p = NULL;
+       pakfire_problem* self = NULL;
 
        // Allocate some memory
-       p = calloc(1, sizeof(*p));
-       if (!p)
+       self = calloc(1, sizeof(*self));
+       if (!self)
                return -errno;
 
        // Store a reference to the context
-       p->ctx = pakfire_ctx_ref(ctx);
+       self->ctx = pakfire_ctx_ref(ctx);
 
        // Store a reference to the root
-       p->root = pakfire_root_ref(root);
+       self->root = pakfire_root_ref(root);
 
        // Initialize the reference counter
-       p->nrefs = 1;
+       self->nrefs = 1;
 
        // Store a reference to the transaction
-       p->transaction = pakfire_transaction_ref(transaction);
+       self->transaction = pakfire_transaction_ref(transaction);
 
        // Store the ID
-       p->id = id;
+       self->id = id;
 
        // Fetch a reference to the solver
-       p->solver = pakfire_transaction_get_solver(transaction);
+       self->solver = pakfire_transaction_get_solver(transaction);
 
        // Return the pointer
-       *problem = p;
+       *problem = self;
 
        return 0;
 }
 
-static void pakfire_problem_free(pakfire_problem* problem) {
-       if (problem->transaction)
-               pakfire_transaction_unref(problem->transaction);
-       if (problem->string)
-               free(problem->string);
-       if (problem->root)
-               pakfire_root_unref(problem->root);
-       if (problem->ctx)
-               pakfire_ctx_unref(problem->ctx);
-       free(problem);
+static void pakfire_problem_free(pakfire_problem* self) {
+       if (self->transaction)
+               pakfire_transaction_unref(self->transaction);
+       if (self->string)
+               free(self->string);
+       if (self->root)
+               pakfire_root_unref(self->root);
+       if (self->ctx)
+               pakfire_ctx_unref(self->ctx);
+       free(self);
 }
 
-pakfire_problem* pakfire_problem_ref(pakfire_problem* problem) {
-       problem->nrefs++;
+pakfire_problem* pakfire_problem_ref(pakfire_problem* self) {
+       self->nrefs++;
 
-       return problem;
+       return self;
 }
 
-pakfire_problem* pakfire_problem_unref(pakfire_problem* problem) {
-       if (--problem->nrefs > 0)
-               return problem;
+pakfire_problem* pakfire_problem_unref(pakfire_problem* self) {
+       if (--self->nrefs > 0)
+               return self;
 
-       pakfire_problem_free(problem);
+       pakfire_problem_free(self);
        return NULL;
 }
 
-const char* pakfire_problem_to_string(pakfire_problem* problem) {
-       if (!problem->string)
-               problem->string = pakfire_problem_make_string(problem);
+const char* pakfire_problem_to_string(pakfire_problem* self) {
+       if (!self->string)
+               self->string = pakfire_problem_make_string(self);
 
-       return problem->string;
+       return self->string;
 }
 
-Id pakfire_problem_get_id(pakfire_problem* problem) {
-       return problem->id;
+Id pakfire_problem_get_id(pakfire_problem* self) {
+       return self->id;
 }
 
-pakfire_transaction* pakfire_problem_get_transaction(pakfire_problem* problem) {
-       return pakfire_transaction_ref(problem->transaction);
+pakfire_transaction* pakfire_problem_get_transaction(pakfire_problem* self) {
+       return pakfire_transaction_ref(self->transaction);
 }
 
-pakfire_solution** pakfire_problem_get_solutions(
-               pakfire_problem* problem) {
+pakfire_solution** pakfire_problem_get_solutions(pakfire_problem* self) {
        pakfire_solution** solutions = NULL;
        pakfire_solution* solution = NULL;
        unsigned int count = 0;
@@ -273,7 +272,7 @@ pakfire_solution** pakfire_problem_get_solutions(
        int r;
 
        // Fetch how many solutions we have
-       count = solver_solution_count(problem->solver, problem->id);
+       count = solver_solution_count(self->solver, self->id);
        if (!count)
                return NULL;
 
@@ -285,12 +284,12 @@ pakfire_solution** pakfire_problem_get_solutions(
        }
 
        for (unsigned int i = 0; i < count; i++) {
-               id = solver_next_solution(problem->solver, problem->id, id);
+               id = solver_next_solution(self->solver, self->id, id);
                if (!id)
                        break;
 
                // Create a new solution
-               r = pakfire_solution_create(&solution, problem->ctx, problem, id);
+               r = pakfire_solution_create(&solution, self->ctx, self, id);
                if (r)
                        goto ERROR;
 
@@ -301,7 +300,7 @@ pakfire_solution** pakfire_problem_get_solutions(
        return solutions;
 
 ERROR:
-       ERROR(problem->ctx, "Could not import solutions: %s\n", strerror(r));
+       ERROR(self->ctx, "Could not import solutions: %s\n", strerror(r));
 
        if (solutions) {
                for (pakfire_solution** s = solutions; *s; s++)