hippo-canvas r7253 - trunk/common/hippo



Author: otaylor
Date: Thu Apr 17 19:49:40 2008
New Revision: 7253
URL: http://svn.gnome.org/viewvc/hippo-canvas?rev=7253&view=rev

Log:
Optimize out no-change changes to 'classes' and 'element_id'


Modified:
   trunk/common/hippo/hippo-canvas-box.c

Modified: trunk/common/hippo/hippo-canvas-box.c
==============================================================================
--- trunk/common/hippo/hippo-canvas-box.c	(original)
+++ trunk/common/hippo/hippo-canvas-box.c	Thu Apr 17 19:49:40 2008
@@ -838,27 +838,31 @@
     case PROP_ID:
         {
             const char *str = g_value_get_string(value);
-            if (str != box->element_id) {
-                if (box->element_id)
-                    g_free(box->element_id);
-                box->element_id = g_strdup(str);
-
-                clear_style(box);
-                hippo_canvas_context_emit_style_changed(HIPPO_CANVAS_CONTEXT(box), TRUE);
-            }
+            if (str == box->element_id ||
+                (str && box->element_id && strcmp(str, box->element_id) == 0))
+                return;
+
+            if (box->element_id)
+                g_free(box->element_id);
+            box->element_id = g_strdup(str);
+            
+            clear_style(box);
+            hippo_canvas_context_emit_style_changed(HIPPO_CANVAS_CONTEXT(box), TRUE);
         }
         break;
     case PROP_CLASSES:
         {
             const char *str = g_value_get_string(value);
-            if (str != box->element_class) {
-                if (box->element_class)
-                    g_free(box->element_class);
-                box->element_class = g_strdup(str);
-                
-                clear_style(box);
-                hippo_canvas_context_emit_style_changed(HIPPO_CANVAS_CONTEXT(box), TRUE);
-            }
+            if (str == box->element_class ||
+                (str && box->element_class && strcmp(str, box->element_class) == 0))
+                return;
+            
+            if (box->element_class)
+                g_free(box->element_class);
+            box->element_class = g_strdup(str);
+            
+            clear_style(box);
+            hippo_canvas_context_emit_style_changed(HIPPO_CANVAS_CONTEXT(box), TRUE);
         }
         break;
     case PROP_ORIENTATION:
@@ -1041,30 +1045,25 @@
     case PROP_TOOLTIP:
         {
             const char *new_tip = g_value_get_string(value);
-            if (new_tip != box->tooltip) {
-                gboolean changed = TRUE;
-                
-                if (new_tip && box->tooltip &&
-                    strcmp(new_tip, box->tooltip) == 0) {
-                    changed = FALSE;
-                }
-
-                if (changed) {
-                    g_free(box->tooltip);
-                    box->tooltip = g_strdup(new_tip);
-                    hippo_canvas_item_emit_tooltip_changed(HIPPO_CANVAS_ITEM(box));
-                }
-            }
+            if (new_tip == box->tooltip ||
+                (new_tip && box->tooltip && strcmp(new_tip, box->tooltip) == 0))
+                return;
+
+            g_free(box->tooltip);
+            box->tooltip = g_strdup(new_tip);
+            hippo_canvas_item_emit_tooltip_changed(HIPPO_CANVAS_ITEM(box));
         }
         need_resize = FALSE;
         break;
     case PROP_DEBUG_NAME:
         {
             const char *new_name  = g_value_get_string(value);
-            if (new_name != box->debug_name) {
-                g_free(box->debug_name);
-                box->debug_name = g_strdup(new_name);
-            }
+            if (new_name == box->debug_name ||
+                (new_name && box->debug_name && strcmp(new_name, box->debug_name) == 0))
+                return;
+            
+            g_free(box->debug_name);
+            box->debug_name = g_strdup(new_name);
         }
         need_resize = FALSE;
         break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]