]> git.ipfire.org Git - pakfire.git/commitdiff
key: Have pakfire_key_unref return a pointer
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Oct 2024 15:20:03 +0000 (15:20 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Oct 2024 16:41:21 +0000 (16:41 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/key.h
src/libpakfire/key.c

index 5ba49a93f59fe5f155dcd8e39c07eac718d0824b..15a0056a2cd3caede08364165818c11b41e47a62 100644 (file)
@@ -40,7 +40,7 @@ typedef enum pakfire_key_export_mode {
 typedef unsigned char pakfire_key_id[8];
 
 struct pakfire_key* pakfire_key_ref(struct pakfire_key* key);
-void pakfire_key_unref(struct pakfire_key* key);
+struct pakfire_key* pakfire_key_unref(struct pakfire_key* key);
 
 // Access key properties
 pakfire_key_id* pakfire_key_get_id(struct pakfire_key* key);
index 349c47de86d9437cbdd0ab8ed08e01afb5fd8d58..b3ca9b7ff5be34270d078573f98cadeb9bb9fdb8 100644 (file)
@@ -167,11 +167,12 @@ PAKFIRE_EXPORT struct pakfire_key* pakfire_key_ref(struct pakfire_key* key) {
        return key;
 }
 
-PAKFIRE_EXPORT void pakfire_key_unref(struct pakfire_key* key) {
+PAKFIRE_EXPORT struct pakfire_key* pakfire_key_unref(struct pakfire_key* key) {
        if (--key->nrefs > 0)
-               return;
+               return key;
 
        pakfire_key_free(key);
+       return NULL;
 }
 
 PAKFIRE_EXPORT pakfire_key_id* pakfire_key_get_id(struct pakfire_key* key) {