[gimp] libgimpcolor: add shortcut in gimp_color_profile_is_equal()
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpcolor: add shortcut in gimp_color_profile_is_equal()
- Date: Fri, 3 Nov 2017 08:29:36 +0000 (UTC)
commit 22a28a23cc39a5f5da2d1d49c64961dc123925b5
Author: Ell <ell_se yahoo com>
Date: Fri Nov 3 03:11:47 2017 -0400
libgimpcolor: add shortcut in gimp_color_profile_is_equal()
When the two pointers are equal, return TRUE immediately, instead
of comparing the profile to itself.
libgimpcolor/gimpcolorprofile.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/libgimpcolor/gimpcolorprofile.c b/libgimpcolor/gimpcolorprofile.c
index 8746d47..4015296 100644
--- a/libgimpcolor/gimpcolorprofile.c
+++ b/libgimpcolor/gimpcolorprofile.c
@@ -667,9 +667,10 @@ gimp_color_profile_is_equal (GimpColorProfile *profile1,
const gsize header_len = sizeof (cmsICCHeader);
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile1), FALSE);
- g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile1), FALSE);
+ g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile2), FALSE);
- return (profile1->priv->length == profile2->priv->length &&
+ return profile1 == profile2 ||
+ (profile1->priv->length == profile2->priv->length &&
memcmp (profile1->priv->data + header_len,
profile2->priv->data + header_len,
profile1->priv->length - header_len) == 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]