From: Michael Tremer Date: Fri, 2 Jul 2021 15:42:42 +0000 (+0000) Subject: problem: Initialize string only when needed X-Git-Tag: 0.9.28~1128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d48f4d8dd24a6bf0c7da8b4fbbb8d18aa43a9ba9;p=pakfire.git problem: Initialize string only when needed Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/problem.c b/src/libpakfire/problem.c index e67131d5e..841408c61 100644 --- a/src/libpakfire/problem.c +++ b/src/libpakfire/problem.c @@ -215,9 +215,6 @@ PAKFIRE_EXPORT int pakfire_problem_create(struct pakfire_problem** problem, p->request = pakfire_request_ref(request); p->id = id; - // Extract information from solver - p->string = to_string(p); - *problem = p; return 0; } @@ -251,6 +248,9 @@ Pakfire pakfire_problem_get_pakfire(struct pakfire_problem* problem) { } PAKFIRE_EXPORT const char* pakfire_problem_to_string(struct pakfire_problem* problem) { + if (!problem->string) + problem->string = to_string(problem); + return problem->string; }