Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_widget.c 


Log Message:
Use shared strings instead, helps reduce memory use when many copies of the
same widget type exist.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ewl_widget.c        13 Nov 2005 07:27:58 -0000      1.37
+++ ewl_widget.c        13 Nov 2005 07:36:07 -0000      1.38
@@ -530,8 +530,6 @@
 void
 ewl_widget_appearance_set(Ewl_Widget * w, char *appearance)
 {
-       int al;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
        DCHECK_PARAM_PTR("appearance", appearance);
@@ -541,14 +539,14 @@
        if (w->appearance && !strcmp(appearance, w->appearance))
                DLEAVE_FUNCTION(DLEVEL_STABLE);
 
-       IF_FREE(w->appearance);
-       al = strlen(appearance) + 1;
+       if (w->appearance)
+               ecore_string_release(w->appearance);
 
        /*
         * The base appearance is used for determining the theme key of the
         * widget.
         */
-       w->appearance = strdup(appearance);
+       w->appearance = ecore_string_instance(appearance);
        if (!w->appearance)
                DRETURN(DLEVEL_STABLE);
 
@@ -1560,18 +1558,6 @@
 
        ewl_widget_unrealize(w);
 
-       /*
-        * Free up appearance related information
-        */
-       ewl_theme_widget_shutdown(w);
-       IF_FREE(w->appearance);
-
-       if (w->inheritance)
-               ecore_string_release(w->inheritance);
-
-       if (w->bit_state)
-               ecore_string_release(w->bit_state);
-
        /* 
         * cleanup the attachment lists 
         */
@@ -1594,6 +1580,20 @@
                ewl_callback_del_type(w, i);
        }
 
+       /*
+        * Free up appearance related information
+        */
+       ewl_theme_widget_shutdown(w);
+
+       if (w->appearance)
+               ecore_string_release(w->appearance);
+
+       if (w->inheritance)
+               ecore_string_release(w->inheritance);
+
+       if (w->bit_state)
+               ecore_string_release(w->bit_state);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to