[osinfo-db-tools PATCH 9/9] util: Use g_clear_*() functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Let's use g_clear_object() & g_clear_error() as those two functions
avoid us checking whether the object is NULL or not and also sets the
object to NULL after unrefing it.

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 tools/osinfo-db-util.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/osinfo-db-util.c b/tools/osinfo-db-util.c
index 1030b06..45d8b58 100644
--- a/tools/osinfo-db-util.c
+++ b/tools/osinfo-db-util.c
@@ -148,8 +148,7 @@ GFile *osinfo_db_get_file(const char *root,
         ret = g_file_resolve_relative_path(paths[i], file);
         if (g_file_query_exists(ret, NULL))
             break;
-        g_object_unref(ret);
-        ret = NULL;
+        g_clear_object(&ret);
     }
 
     if (!ret) {
-- 
2.21.0

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux