]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: Make pakfire_pool_unref the same style as others
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 15 Jan 2018 23:36:54 +0000 (00:36 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 15 Jan 2018 23:36:54 +0000 (00:36 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/pool.h
src/libpakfire/pool.c

index 8ba4f2b36f929030e76a969d3dd88528ca0ca402..3bae21067936060d931978ad175c53ba9bec9950 100644 (file)
@@ -24,8 +24,9 @@
 #include <pakfire/types.h>
 
 PakfirePool pakfire_pool_create(Pakfire pakfire);
+
 PakfirePool pakfire_pool_ref(PakfirePool pool);
-void pakfire_pool_unref(PakfirePool pool);
+PakfirePool pakfire_pool_unref(PakfirePool pool);
 
 int pakfire_pool_version_compare(PakfirePool pool, const char* evr1, const char* evr2);
 int pakfire_pool_count(PakfirePool pool);
index 6bbf4f719b8dc6a0e7db6cacfb2e02ecc6fb8ea2..a14ce13803c1b841f698351f4b78a89225209de7 100644 (file)
@@ -97,11 +97,15 @@ PAKFIRE_EXPORT PakfirePool pakfire_pool_ref(PakfirePool pool) {
        return pool;
 }
 
-PAKFIRE_EXPORT void pakfire_pool_unref(PakfirePool pool) {
+PAKFIRE_EXPORT PakfirePool pakfire_pool_unref(PakfirePool pool) {
+       if (!pool)
+               return NULL;
+
        if (--pool->nrefs > 0)
-               return;
+               return pool;
 
        pakfire_pool_free(pool);
+       return NULL;
 }
 
 Pool* pakfire_pool_get_solv_pool(PakfirePool pool) {