return r;
}
-static int cli_term_print_problem(struct pakfire_problem* problem, unsigned int* num_solutions) {
+static int cli_term_print_problem(pakfire_problem* problem, unsigned int* num_solutions) {
struct pakfire_solution** solutions = NULL;
// Show what the problem is
}
static struct pakfire_solution* cli_term_find_solution(
- struct pakfire_problem** problems, const unsigned int choice) {
+ pakfire_problem** problems, const unsigned int choice) {
struct pakfire_solution* selected_solution = NULL;
struct pakfire_solution** solutions = NULL;
// Count solutions
unsigned int i = 1;
- for (struct pakfire_problem** problem = problems; *problem; problem++) {
+ for (pakfire_problem** problem = problems; *problem; problem++) {
// Fetch solutions
solutions = pakfire_problem_get_solutions(*problem);
if (!solutions)
int cli_term_pick_solution(pakfire_ctx* ctx, struct pakfire* pakfire, void* data,
struct pakfire_transaction* transaction) {
- struct pakfire_problem** problems = NULL;
+ pakfire_problem** problems = NULL;
struct pakfire_solution* solution = NULL;
unsigned int num_solutions = 0;
unsigned int choice = 0;
printf("%s\n", _("One or more problems have occurred solving your request:"));
// Show all problems
- for (struct pakfire_problem** p = problems; *p; p++) {
+ for (pakfire_problem** p = problems; *p; p++) {
r = cli_term_print_problem(*p, &num_solutions);
if (r)
goto ERROR;
ERROR:
if (problems) {
- for (struct pakfire_problem** p = problems; *p; p++)
+ for (pakfire_problem** p = problems; *p; p++)
pakfire_problem_unref(*p);
free(problems);
Solver* solver;
};
-static char* pakfire_problem_make_string(struct pakfire_problem* problem) {
+static char* pakfire_problem_make_string(pakfire_problem* problem) {
Solver* solver = pakfire_transaction_get_solver(problem->transaction);
Pool* pool = solver->pool;
return s;
}
-int pakfire_problem_create(struct pakfire_problem** problem,
+int pakfire_problem_create(pakfire_problem** problem,
struct pakfire* pakfire, struct pakfire_transaction* transaction, Id id) {
- struct pakfire_problem* p = NULL;
+ pakfire_problem* p = NULL;
// Allocate some memory
p = calloc(1, sizeof(*p));
return 0;
}
-static void pakfire_problem_free(struct pakfire_problem* problem) {
+static void pakfire_problem_free(pakfire_problem* problem) {
if (problem->transaction)
pakfire_transaction_unref(problem->transaction);
if (problem->string)
free(problem);
}
-struct pakfire_problem* pakfire_problem_ref(struct pakfire_problem* problem) {
+pakfire_problem* pakfire_problem_ref(pakfire_problem* problem) {
problem->nrefs++;
return problem;
}
-struct pakfire_problem* pakfire_problem_unref(struct pakfire_problem* problem) {
+pakfire_problem* pakfire_problem_unref(pakfire_problem* problem) {
if (--problem->nrefs > 0)
return problem;
return NULL;
}
-const char* pakfire_problem_to_string(struct pakfire_problem* problem) {
+const char* pakfire_problem_to_string(pakfire_problem* problem) {
if (!problem->string)
problem->string = pakfire_problem_make_string(problem);
return problem->string;
}
-Id pakfire_problem_get_id(struct pakfire_problem* problem) {
+Id pakfire_problem_get_id(pakfire_problem* problem) {
return problem->id;
}
-struct pakfire_transaction* pakfire_problem_get_transaction(struct pakfire_problem* problem) {
+struct pakfire_transaction* pakfire_problem_get_transaction(pakfire_problem* problem) {
return pakfire_transaction_ref(problem->transaction);
}
struct pakfire_solution** pakfire_problem_get_solutions(
- struct pakfire_problem* problem) {
+ pakfire_problem* problem) {
struct pakfire_solution** solutions = NULL;
struct pakfire_solution* solution = NULL;
unsigned int count = 0;
// libsolv
#include <solv/pooltypes.h>
-struct pakfire_problem;
+typedef struct pakfire_problem pakfire_problem;
#include <pakfire/solution.h>
#include <pakfire/transaction.h>
-struct pakfire_problem* pakfire_problem_ref(struct pakfire_problem* problem);
-struct pakfire_problem* pakfire_problem_unref(struct pakfire_problem* problem);
+pakfire_problem* pakfire_problem_ref(pakfire_problem* problem);
+pakfire_problem* pakfire_problem_unref(pakfire_problem* problem);
-const char* pakfire_problem_to_string(struct pakfire_problem* problem);
+const char* pakfire_problem_to_string(pakfire_problem* problem);
struct pakfire_solution** pakfire_problem_get_solutions(
- struct pakfire_problem* problem);
+ pakfire_problem* problem);
-int pakfire_problem_create(struct pakfire_problem** problem, struct pakfire* pakfire,
+int pakfire_problem_create(pakfire_problem** problem, struct pakfire* pakfire,
struct pakfire_transaction* transaction, Id id);
-struct pakfire_transaction* pakfire_problem_get_transaction(struct pakfire_problem* problem);
+struct pakfire_transaction* pakfire_problem_get_transaction(pakfire_problem* problem);
-Id pakfire_problem_get_id(struct pakfire_problem* problem);
+Id pakfire_problem_get_id(pakfire_problem* problem);
#endif /* PAKFIRE_PROBLEM_H */
struct pakfire* pakfire;
int nrefs;
- struct pakfire_problem* problem;
+ pakfire_problem* problem;
Id id;
char* string;
};
int pakfire_solution_create(struct pakfire_solution** solution,
- struct pakfire* pakfire, struct pakfire_problem* problem, Id id) {
+ struct pakfire* pakfire, pakfire_problem* problem, Id id) {
struct pakfire_solution* s = calloc(1, sizeof(*s));
if (!s)
return -errno;
return NULL;
}
-struct pakfire_problem* pakfire_solution_get_problem(struct pakfire_solution* solution) {
+pakfire_problem* pakfire_solution_get_problem(struct pakfire_solution* solution) {
return pakfire_problem_ref(solution->problem);
}
const char* pakfire_solution_to_string(struct pakfire_solution* solution);
int pakfire_solution_create(struct pakfire_solution** solution, struct pakfire* pakfire,
- struct pakfire_problem* problem, Id id);
-struct pakfire_problem* pakfire_solution_get_problem(struct pakfire_solution* solution);
+ pakfire_problem* problem, Id id);
+pakfire_problem* pakfire_solution_get_problem(struct pakfire_solution* solution);
Id pakfire_solution_get_id(struct pakfire_solution* solution);
#endif /* PAKFIRE_SOLUTION_H */
return NULL;
}
-struct pakfire_problem** pakfire_transaction_get_problems(
+pakfire_problem** pakfire_transaction_get_problems(
struct pakfire_transaction* transaction) {
- struct pakfire_problem** problems = NULL;
- struct pakfire_problem* problem = NULL;
+ pakfire_problem** problems = NULL;
+ pakfire_problem* problem = NULL;
unsigned int count = 0;
Id id = ID_NULL;
int r;
ERROR(transaction->ctx, "Could not import problems: %s\n", strerror(r));
if (problems) {
- for (struct pakfire_problem** p = problems; *p; p++)
+ for (pakfire_problem** p = problems; *p; p++)
pakfire_problem_unref(*p);
free(problems);
}
}
static int pakfire_transaction_append_problems(
- struct pakfire_transaction* transaction, char** buffer, struct pakfire_problem** problems, int flags) {
+ struct pakfire_transaction* transaction, char** buffer, pakfire_problem** problems, int flags) {
struct pakfire_solution** solutions = NULL;
const char* s = NULL;
int r;
- for (struct pakfire_problem** problem = problems; *problem; problem++) {
+ for (pakfire_problem** problem = problems; *problem; problem++) {
s = pakfire_problem_to_string(*problem);
if (!s)
return -errno;
static char* pakfire_transaction_get_problem_string(
struct pakfire_transaction* transaction, int flags) {
- struct pakfire_problem** problems = NULL;
+ pakfire_problem** problems = NULL;
char* buffer = NULL;
int r;
// Cleanup
if (problems) {
- for (struct pakfire_problem** problem = problems; *problem; problem++)
+ for (pakfire_problem** problem = problems; *problem; problem++)
pakfire_problem_unref(*problem);
free(problems);
int pakfire_transaction_take_solution(struct pakfire_transaction* transaction,
struct pakfire_solution* solution) {
- struct pakfire_problem* problem = pakfire_solution_get_problem(solution);
+ pakfire_problem* problem = pakfire_solution_get_problem(solution);
// Fetch IDs
Id problem_id = pakfire_problem_get_id(problem);
int pakfire_transaction_request_package(struct pakfire_transaction* transaction,
const enum pakfire_job_action action, pakfire_package* package, int flags);
-struct pakfire_problem** pakfire_transaction_get_problems(struct pakfire_transaction* transaction);
+pakfire_problem** pakfire_transaction_get_problems(struct pakfire_transaction* transaction);
int pakfire_transaction_take_solution(
struct pakfire_transaction* transaction, struct pakfire_solution* solution);
#include "problem.h"
#include "solution.h"
-static ProblemObject* Problem_new_core(PyTypeObject* type, struct pakfire_problem* problem) {
+static ProblemObject* Problem_new_core(PyTypeObject* type, pakfire_problem* problem) {
ProblemObject* self = (ProblemObject *)type->tp_alloc(type, 0);
if (self) {
self->problem = problem;
return self;
}
-PyObject* new_problem(struct pakfire_problem* problem) {
+PyObject* new_problem(pakfire_problem* problem) {
ProblemObject* p = Problem_new_core(&ProblemType, problem);
return (PyObject*)p;
typedef struct {
PyObject_HEAD
- struct pakfire_problem* problem;
+ pakfire_problem* problem;
} ProblemObject;
extern PyTypeObject ProblemType;
-PyObject* new_problem(struct pakfire_problem* problem);
+PyObject* new_problem(pakfire_problem* problem);
#endif /* PYTHON_PAKFIRE_PROBLEM_H */