[Libosinfo] [osinfo-db-tools PATCH 9/9] util: Use g_clear_*() functions
Fabiano Fidêncio
fidencio at redhat.com
Fri Jun 28 09:41:20 UTC 2019
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 at redhat.com>
---
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
More information about the Libosinfo
mailing list