[glib] gfile: g_file_equal (x, x) is TRUE
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gfile: g_file_equal (x, x) is TRUE
- Date: Tue, 21 Oct 2014 20:51:55 +0000 (UTC)
commit 4125415e7f4d1213fc7122beac0d91af08e37b28
Author: Benjamin Otte <otte redhat com>
Date: Sun Oct 12 02:21:08 2014 +0200
gfile: g_file_equal (x, x) is TRUE
So shortcut it.
I wrote this patch less as a performance optimization and more as a
clarification, so that people looking at the code can be assured of this
invariant.
https://bugzilla.gnome.org/show_bug.cgi?id=738374
gio/gfile.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gio/gfile.c b/gio/gfile.c
index 0facca1..2e1e3cb 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -660,6 +660,9 @@ g_file_equal (GFile *file1,
g_return_val_if_fail (G_IS_FILE (file1), FALSE);
g_return_val_if_fail (G_IS_FILE (file2), FALSE);
+ if (file1 == file2)
+ return TRUE;
+
if (G_TYPE_FROM_INSTANCE (file1) != G_TYPE_FROM_INSTANCE (file2))
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]