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
This commit is contained in:
Benjamin Otte 2014-10-12 02:21:08 +02:00
parent b768d0e4ea
commit 4125415e7f

View File

@ -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 (file1), FALSE);
g_return_val_if_fail (G_IS_FILE (file2), 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)) if (G_TYPE_FROM_INSTANCE (file1) != G_TYPE_FROM_INSTANCE (file2))
return FALSE; return FALSE;