]> git.ipfire.org Git - pakfire.git/commitdiff
problems: Change type from PakfireProblem* to struct pakfire_problem
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Jun 2021 21:09:56 +0000 (21:09 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Jun 2021 21:09:56 +0000 (21:09 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/problem.c
src/_pakfire/problem.h
src/libpakfire/include/pakfire/problem.h
src/libpakfire/include/pakfire/request.h
src/libpakfire/include/pakfire/solution.h
src/libpakfire/include/pakfire/types.h
src/libpakfire/problem.c
src/libpakfire/request.c
src/libpakfire/solution.c

index f02ae26ae623519debd2501884261d8470b5644f..23f4430f850aa8fc28696dfa8ddd250354b09191 100644 (file)
@@ -25,7 +25,7 @@
 #include "problem.h"
 #include "solution.h"
 
-static ProblemObject* Problem_new_core(PyTypeObject* type, PakfireProblem problem) {
+static ProblemObject* Problem_new_core(PyTypeObject* type, struct pakfire_problem* problem) {
        ProblemObject* self = (ProblemObject *)type->tp_alloc(type, 0);
        if (self) {
                self->problem = problem;
@@ -34,7 +34,7 @@ static ProblemObject* Problem_new_core(PyTypeObject* type, PakfireProblem proble
        return self;
 }
 
-PyObject* new_problem(PakfireProblem problem) {
+PyObject* new_problem(struct pakfire_problem* problem) {
        ProblemObject* p = Problem_new_core(&ProblemType, problem);
 
        return (PyObject*)p;
index 7146b5c5da1c4773901ae45f13af51c1a9f6d166..ca581ad5bf611c0168588f9ac05566115ee2658d 100644 (file)
 
 typedef struct {
        PyObject_HEAD
-       PakfireProblem problem;
+       struct pakfire_problem* problem;
 } ProblemObject;
 
 extern PyTypeObject ProblemType;
 
-PyObject* new_problem(PakfireProblem problem);
+PyObject* new_problem(struct pakfire_problem* problem);
 
 #endif /* PYTHON_PAKFIRE_PROBLEM_H */
index 76a692122bc6b3eaee2d56309db26dc8a7c8518f..e96bc4818cfa60b0eae8de06599a32209c3f132f 100644 (file)
 
 #include <pakfire/request.h>
 
-PakfireProblem pakfire_problem_create(struct pakfire_request* request, Id id);
-PakfireProblem pakfire_problem_ref(PakfireProblem problem);
-PakfireProblem pakfire_problem_unref(PakfireProblem problem);
+struct pakfire_problem;
 
-PakfireProblem pakfire_problem_next(PakfireProblem problem);
-void pakfire_problem_append(PakfireProblem problem, PakfireProblem new_problem);
+struct pakfire_problem* pakfire_problem_create(struct pakfire_request* request, Id id);
+struct pakfire_problem* pakfire_problem_ref(struct pakfire_problem* problem);
+struct pakfire_problem* pakfire_problem_unref(struct pakfire_problem* problem);
 
-const char* pakfire_problem_to_string(PakfireProblem problem);
+struct pakfire_problem* pakfire_problem_next(struct pakfire_problem* problem);
+void pakfire_problem_append(struct pakfire_problem* problem, struct pakfire_problem* new_problem);
 
-struct pakfire_request* pakfire_problem_get_request(PakfireProblem problem);
-PakfireSolution pakfire_problem_get_solutions(PakfireProblem problem);
+const char* pakfire_problem_to_string(struct pakfire_problem* problem);
+
+struct pakfire_request* pakfire_problem_get_request(struct pakfire_problem* problem);
+PakfireSolution pakfire_problem_get_solutions(struct pakfire_problem* problem);
 
 #ifdef PAKFIRE_PRIVATE
 
-Pakfire pakfire_problem_get_pakfire(PakfireProblem problem);
-Id pakfire_problem_get_id(PakfireProblem problem);
+Pakfire pakfire_problem_get_pakfire(struct pakfire_problem* problem);
+Id pakfire_problem_get_id(struct pakfire_problem* problem);
 
 #endif
 
index cfafd219da94c267aa4ee18ac73af2010cc053bd..47dd65e689cb1833ac07af9e72f750d4ed0056b8 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef PAKFIRE_REQUEST_H
 #define PAKFIRE_REQUEST_H
 
+#include <pakfire/problem.h>
 #include <pakfire/transaction.h>
 #include <pakfire/types.h>
 
@@ -46,7 +47,7 @@ struct pakfire_request* pakfire_request_unref(struct pakfire_request* request);
 
 int pakfire_request_solve(struct pakfire_request* request,
        struct pakfire_transaction** transaction);
-PakfireProblem pakfire_request_get_problems(struct pakfire_request* request);
+struct pakfire_problem* pakfire_request_get_problems(struct pakfire_request* request);
 
 int pakfire_request_install(struct pakfire_request* request, const char* what, int flags);
 int pakfire_request_install_package(struct pakfire_request* request, PakfirePackage package);
index 026491f4a8da864de9e4be86a8a56e28b483950e..1c833a5138fc3208156606132ffb753e6818386b 100644 (file)
 #ifndef PAKFIRE_SOLUTION_H
 #define PAKFIRE_SOLUTION_H
 
+#include <solv/pooltypes.h>
+
 #include <pakfire/problem.h>
 
-PakfireSolution pakfire_solution_create(PakfireProblem problem, Id id);
+PakfireSolution pakfire_solution_create(struct pakfire_problem* problem, Id id);
 PakfireSolution pakfire_solution_ref(PakfireSolution solution);
 PakfireSolution pakfire_solution_unref(PakfireSolution solution);
 
index d07f11c0da4cf39e943edcb659113fb678b3db26..5335ccefb3725d732ee7c781ee321ff1df0dccdb 100644 (file)
@@ -31,7 +31,6 @@ typedef struct _PakfireKey* PakfireKey;
 typedef struct _PakfirePackage* PakfirePackage;
 typedef struct _PakfirePackageList* PakfirePackageList;
 typedef struct _PakfireParser* PakfireParser;
-typedef struct _PakfireProblem* PakfireProblem;
 typedef struct _PakfireRepo* PakfireRepo;
 typedef struct _PakfireSolution* PakfireSolution;
 
index 31f0c9e4c2bc3875a9f92b4eb5a0d762c3fb0e0f..f8067055d65ccc26b1077a679c94354e6b6aece3 100644 (file)
 #include <pakfire/solution.h>
 #include <pakfire/util.h>
 
-struct _PakfireProblem {
+struct pakfire_problem {
        Pakfire pakfire;
        struct pakfire_request* request;
        Id id;
        char* string;
 
-       PakfireProblem next;
+       struct pakfire_problem* next;
        int nrefs;
 };
 
-static char* to_string(PakfireProblem problem) {
+static char* to_string(struct pakfire_problem* problem) {
        Solver* solver = pakfire_request_get_solver(problem->request);
        Pool* pool = solver->pool;
 
@@ -204,10 +204,10 @@ static char* to_string(PakfireProblem problem) {
        return strdup(s);
 }
 
-PAKFIRE_EXPORT PakfireProblem pakfire_problem_create(struct pakfire_request* request, Id id) {
+PAKFIRE_EXPORT struct pakfire_problem* pakfire_problem_create(struct pakfire_request* request, Id id) {
        Pakfire pakfire = pakfire_request_get_pakfire(request);
 
-       PakfireProblem problem = calloc(1, sizeof(*problem));
+       struct pakfire_problem* problem = calloc(1, sizeof(*problem));
        if (problem) {
                problem->pakfire = pakfire_ref(pakfire);
                problem->nrefs = 1;
@@ -224,13 +224,13 @@ PAKFIRE_EXPORT PakfireProblem pakfire_problem_create(struct pakfire_request* req
        return problem;
 }
 
-PAKFIRE_EXPORT PakfireProblem pakfire_problem_ref(PakfireProblem problem) {
+PAKFIRE_EXPORT struct pakfire_problem* pakfire_problem_ref(struct pakfire_problem* problem) {
        problem->nrefs++;
 
        return problem;
 }
 
-static void pakfire_problem_free(PakfireProblem problem) {
+static void pakfire_problem_free(struct pakfire_problem* problem) {
        pakfire_problem_unref(problem->next);
        pakfire_request_unref(problem->request);
 
@@ -241,7 +241,7 @@ static void pakfire_problem_free(PakfireProblem problem) {
        free(problem);
 }
 
-PAKFIRE_EXPORT PakfireProblem pakfire_problem_unref(PakfireProblem problem) {
+PAKFIRE_EXPORT struct pakfire_problem* pakfire_problem_unref(struct pakfire_problem* problem) {
        if (!problem)
                return NULL;
 
@@ -252,16 +252,16 @@ PAKFIRE_EXPORT PakfireProblem pakfire_problem_unref(PakfireProblem problem) {
        return NULL;
 }
 
-Pakfire pakfire_problem_get_pakfire(PakfireProblem problem) {
+Pakfire pakfire_problem_get_pakfire(struct pakfire_problem* problem) {
        return pakfire_ref(problem->pakfire);
 }
 
-PAKFIRE_EXPORT PakfireProblem pakfire_problem_next(PakfireProblem problem) {
+PAKFIRE_EXPORT struct pakfire_problem* pakfire_problem_next(struct pakfire_problem* problem) {
        return problem->next;
 }
 
-PAKFIRE_EXPORT void pakfire_problem_append(PakfireProblem problem, PakfireProblem new_problem) {
-       PakfireProblem next;
+PAKFIRE_EXPORT void pakfire_problem_append(struct pakfire_problem* problem, struct pakfire_problem* new_problem) {
+       struct pakfire_problem* next;
 
        // Go to last problem in list
        while ((next = pakfire_problem_next(problem)) != NULL) {
@@ -271,19 +271,19 @@ PAKFIRE_EXPORT void pakfire_problem_append(PakfireProblem problem, PakfireProble
        problem->next = pakfire_problem_ref(new_problem);
 }
 
-PAKFIRE_EXPORT const char* pakfire_problem_to_string(PakfireProblem problem) {
+PAKFIRE_EXPORT const char* pakfire_problem_to_string(struct pakfire_problem* problem) {
        return problem->string;
 }
 
-Id pakfire_problem_get_id(PakfireProblem problem) {
+Id pakfire_problem_get_id(struct pakfire_problem* problem) {
        return problem->id;
 }
 
-PAKFIRE_EXPORT struct pakfire_request* pakfire_problem_get_request(PakfireProblem problem) {
+PAKFIRE_EXPORT struct pakfire_request* pakfire_problem_get_request(struct pakfire_problem* problem) {
        return pakfire_request_ref(problem->request);
 }
 
-PAKFIRE_EXPORT PakfireSolution pakfire_problem_get_solutions(PakfireProblem problem) {
+PAKFIRE_EXPORT PakfireSolution pakfire_problem_get_solutions(struct pakfire_problem* problem) {
        PakfireSolution ret = NULL;
        Solver* solver = pakfire_request_get_solver(problem->request);
 
index fafda7e37920067a20b32585a177c969e4731c3e..4dc98ebf0ef7193c502aa0cb588e37142bd7675a 100644 (file)
@@ -193,12 +193,12 @@ ERROR:
        return r;
 }
 
-PAKFIRE_EXPORT PakfireProblem pakfire_request_get_problems(struct pakfire_request* request) {
+PAKFIRE_EXPORT struct pakfire_problem* pakfire_request_get_problems(struct pakfire_request* request) {
        Id problem = 0;
-       PakfireProblem ret = NULL;
+       struct pakfire_problem* ret = NULL;
 
        while ((problem = solver_next_problem(request->solver, problem)) != 0) {
-               PakfireProblem p = pakfire_problem_create(request, problem);
+               struct pakfire_problem* p = pakfire_problem_create(request, problem);
 
                if (ret)
                        pakfire_problem_append(ret, p);
index ce21c12dec0a9cda0066328c5f194993560aa0e7..5eead890bd22a9b526751c2662eb5fd1a04532a3 100644 (file)
@@ -33,7 +33,7 @@
 
 struct _PakfireSolution {
        Pakfire pakfire;
-       PakfireProblem problem;
+       struct pakfire_problem* problem;
        Id id;
        char** elements;
 
@@ -119,7 +119,7 @@ static void import_elements(PakfireSolution solution) {
        pakfire_request_unref(request);
 }
 
-PAKFIRE_EXPORT PakfireSolution pakfire_solution_create(PakfireProblem problem, Id id) {
+PAKFIRE_EXPORT PakfireSolution pakfire_solution_create(struct pakfire_problem* problem, Id id) {
        Pakfire pakfire = pakfire_problem_get_pakfire(problem);
 
        PakfireSolution solution = calloc(1, sizeof(*solution));