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.
This commit is contained in:
Ell 2017-11-03 03:11:47 -04:00
parent 2520e0455c
commit 22a28a23cc
1 changed files with 3 additions and 2 deletions

View File

@ -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);