[osinfo-db-tools PATCH 6/9] path: 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-path.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/osinfo-db-path.c b/tools/osinfo-db-path.c
index 8ef7e55..cd133a3 100644
--- a/tools/osinfo-db-path.c
+++ b/tools/osinfo-db-path.c
@@ -102,9 +102,7 @@ gint main(gint argc, gchar **argv)
     ret = EXIT_SUCCESS;
 
  error:
-    if (dir) {
-        g_object_unref(dir);
-    }
+    g_clear_object(&dir);
     g_clear_error(&error);
     g_option_context_free(context);
 
-- 
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