From: Michael Tremer Date: Sun, 26 Jan 2025 12:28:48 +0000 (+0000) Subject: deps: Make the pool for version comparisons persistent X-Git-Tag: 0.9.30~373 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a75ee9a8decc4140fc208cbda2f1fcd076222db2;p=pakfire.git deps: Make the pool for version comparisons persistent This should perform better on the build service when we are sorting packages, etc. since we can re-use the pool/string pool and serialization. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/deps.c b/src/pakfire/deps.c index b001eb73..cf81ac99 100644 --- a/src/pakfire/deps.c +++ b/src/pakfire/deps.c @@ -64,24 +64,23 @@ static const struct pakfire_rich_operation { This function can compare package versions without a Pakfire instance initialized. */ int pakfire_static_version_compare(const char* evr1, const char* evr2) { - Pool* pool = NULL; + static Pool* pool = NULL; int r; // Initialize the pool - pool = pool_create(); - if (!pool) - return 0; - - // Set to RPM mode - pool_setdisttype(pool, DISTTYPE_RPM); + if (!pool) { + printf("GOT HERE\n"); - // Perform comparison - r = pool_evrcmp_str(pool, evr1, evr2, EVRCMP_COMPARE); + pool = pool_create(); + if (!pool) + return 0; - // Free the pool - pool_free(pool); + // Set to RPM mode + pool_setdisttype(pool, DISTTYPE_RPM); + } - return r; + // Perform comparison + return pool_evrcmp_str(pool, evr1, evr2, EVRCMP_COMPARE); } const char* pakfire_dep2str(struct pakfire* pakfire, Id id) {