[gvfs/wip/goa: 4/8] client: Don't guard against g_object_new returning NULL
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/goa: 4/8] client: Don't guard against g_object_new returning NULL
- Date: Thu, 23 Oct 2014 17:22:16 +0000 (UTC)
commit 0faf230abb06caf9df27565e82c2b0f21a03e161
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Oct 23 16:10:20 2014 +0200
client: Don't guard against g_object_new returning NULL
The call to g_daemon_mount_new is a call to g_object_new like any
other. There is no point in checking if g_object_new failed to create
an object, because it will always succeed unless we have run out of
virtual address space and in that case the program will be aborted
anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=739075
client/gdaemonfile.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c
index 571da1e..88f53b0 100644
--- a/client/gdaemonfile.c
+++ b/client/gdaemonfile.c
@@ -2291,8 +2291,7 @@ g_daemon_file_find_enclosing_mount (GFile *file,
}
g_mount_info_unref (mount_info);
- if (mount)
- return G_MOUNT (mount);
+ return G_MOUNT (mount);
}
g_set_error_literal (error, G_IO_ERROR,
@@ -3492,12 +3491,8 @@ find_enclosing_mount_cb (GMountInfo *mount_info,
if (mount == NULL)
mount = g_daemon_mount_new (mount_info, NULL);
- if (mount)
- g_simple_async_result_set_op_res_gpointer (data->result, mount, g_object_unref);
- else
- g_simple_async_result_set_error (data->result, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Internal error: \"%s\"",
- "Mount info did not yield a mount");
+ g_simple_async_result_set_op_res_gpointer (data->result, mount, g_object_unref);
+ goto out;
}
out:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]