diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2015-03-29 17:34:57 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2015-04-10 10:08:35 +0200 |
commit | 090543fa9a89b7d2361e0c188508685351f2c62c (patch) | |
tree | 1c0f050c1bbdcea183e009ea977c7ae032eca4ee | |
parent | ee43020b58cd0fd02a2b53b88e8c878f4230d47e (diff) | |
download | gvfs-090543fa9a89b7d2361e0c188508685351f2c62c.tar.gz |
Rework code flow in g_daemon_file_query_writable_namespaces()
This makes the common (non-error) case more linear, and thus a bit more
readable. This is in preparation for the next commits.
https://bugzilla.gnome.org/show_bug.cgi?id=747362
-rw-r--r-- | client/gdaemonfile.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c index 40341aea..8403d0f0 100644 --- a/client/gdaemonfile.c +++ b/client/gdaemonfile.c @@ -2588,8 +2588,8 @@ g_daemon_file_query_writable_namespaces (GFile *file, GCancellable *cancellable, GError **error) { - GVfsDBusMount *proxy; - char *path; + GVfsDBusMount *proxy = NULL; + char *path = NULL; gboolean res; GVariant *iter_list; GFileAttributeInfoList *list; @@ -2611,27 +2611,23 @@ g_daemon_file_query_writable_namespaces (GFile *file, if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) _g_dbus_send_cancelled_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (proxy))); _g_propagate_error_stripped (error, local_error); - } - - g_free (path); - g_object_unref (proxy); - - if (res) - { - list = _g_dbus_get_attribute_info_list (iter_list, error); - g_variant_unref (iter_list); - } - else - { list = g_file_attribute_info_list_new (); + goto out; } + list = _g_dbus_get_attribute_info_list (iter_list, error); + g_variant_unref (iter_list); + +out: g_file_attribute_info_list_add (list, "metadata", G_FILE_ATTRIBUTE_TYPE_STRING, /* Also STRINGV, but no way express this ... */ G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE | G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED); - + g_free (path); + if (proxy != NULL) + g_object_unref (proxy); + return list; } |