{ NULL, 0 },
};
-static Pool* __pool = NULL;
-
/*
This function can compare package versions without a Pakfire instance initialized.
*/
PAKFIRE_EXPORT int pakfire_static_version_compare(const char* evr1, const char* evr2) {
- // Initialize the pool (unless already done)
- if (!__pool) {
- __pool = pool_create();
+ Pool* pool = NULL;
+ int r;
- if (!__pool)
- return 0;
+ // Initialize the pool
+ pool = pool_create();
+ if (!pool)
+ return 0;
- // Set to RPM mode
- pool_setdisttype(__pool, DISTTYPE_RPM);
- }
+ // Set to RPM mode
+ pool_setdisttype(pool, DISTTYPE_RPM);
// Perform comparison
- return pool_evrcmp_str(__pool, evr1, evr2, EVRCMP_COMPARE);
+ r = pool_evrcmp_str(pool, evr1, evr2, EVRCMP_COMPARE);
+
+ // Free the pool
+ pool_free(pool);
+
+ return r;
}
const char* pakfire_dep2str(struct pakfire* pakfire, Id id) {