StThemeNode: add a trivial-case short cut to all comparisons for equality

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687465
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
This commit is contained in:
Simon McVittie 2012-11-15 15:16:12 +00:00
parent 4fc6a804f5
commit 52036871d1

View File

@ -341,6 +341,10 @@ gboolean
st_theme_node_equal (StThemeNode *node_a, StThemeNode *node_b) st_theme_node_equal (StThemeNode *node_a, StThemeNode *node_b)
{ {
g_return_val_if_fail (ST_IS_THEME_NODE (node_a), FALSE); g_return_val_if_fail (ST_IS_THEME_NODE (node_a), FALSE);
if (node_a == node_b)
return TRUE;
g_return_val_if_fail (ST_IS_THEME_NODE (node_b), FALSE); g_return_val_if_fail (ST_IS_THEME_NODE (node_b), FALSE);
if (node_a->parent_node != node_b->parent_node || if (node_a->parent_node != node_b->parent_node ||
@ -3548,6 +3552,10 @@ st_theme_node_geometry_equal (StThemeNode *node,
StSide side; StSide side;
g_return_val_if_fail (ST_IS_THEME_NODE (node), FALSE); g_return_val_if_fail (ST_IS_THEME_NODE (node), FALSE);
if (node == other)
return TRUE;
g_return_val_if_fail (ST_IS_THEME_NODE (other), FALSE); g_return_val_if_fail (ST_IS_THEME_NODE (other), FALSE);
_st_theme_node_ensure_geometry (node); _st_theme_node_ensure_geometry (node);
@ -3592,6 +3600,10 @@ st_theme_node_paint_equal (StThemeNode *node,
int i; int i;
g_return_val_if_fail (ST_IS_THEME_NODE (node), FALSE); g_return_val_if_fail (ST_IS_THEME_NODE (node), FALSE);
if (node == other)
return TRUE;
g_return_val_if_fail (ST_IS_THEME_NODE (other), FALSE); g_return_val_if_fail (ST_IS_THEME_NODE (other), FALSE);
_st_theme_node_ensure_background (node); _st_theme_node_ensure_background (node);