Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        edje_load.c edje_main.c edje_private.h 


Log Message:


no need to alloc path and part strings if its cached and thus shared
anyway... so detect and re-cycle :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_load.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -3 -r1.77 -r1.78
--- edje_load.c 23 Nov 2005 14:00:39 -0000      1.77
+++ edje_load.c 28 Nov 2005 09:54:06 -0000      1.78
@@ -39,10 +39,18 @@
    
    _edje_file_del(ed);
    
-   if (ed->path) free(ed->path);
-   ed->path = strdup(file);
-   if (ed->part) free(ed->part);
-   ed->part = strdup(part);
+   if (ed->path)
+     {
+       if (!ed->no_free_path) free(ed->path);
+     }
+   if (ed->part)
+     {
+       if (!ed->no_free_part) free(ed->part);
+     }
+   ed->path = file;
+   ed->part = part;
+//   ed->path = strdup(file);
+//   ed->part = strdup(part);
    
    ed->load_error = EDJE_LOAD_ERROR_NONE;
    _edje_file_add(ed);
@@ -51,7 +59,7 @@
      {
        Evas_List *l;
        int errors = 0;
-       
+
        /* check for invalid loops */
        for (l = ed->collection->parts; (l && ! errors); l = l->next)
          {
@@ -137,6 +145,10 @@
             if (!rp)
               {
                  ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
+                 ed->no_free_path = 0;
+                 ed->no_free_part = 0;
+                 ed->path = strdup(ed->path);
+                 ed->part = strdup(ed->part);
                  return 0;
               }
             rp->part = ep;
@@ -318,12 +330,25 @@
        _edje_unref(ed);
        ed->load_error = EDJE_LOAD_ERROR_NONE;
        _edje_emit(ed, "load", NULL);
+       ed->path = ed->file->path;
+       ed->part = ed->collection->part;
+       ed->no_free_path = 1;
+       ed->no_free_part = 1;
        return 1;
      }
    else
      {
+       ed->no_free_path = 0;
+       ed->no_free_part = 0;
+       ed->path = strdup(ed->path);
+       ed->part = strdup(ed->part);
        return 0;
      }
+   /* we should never get here anyway */
+   ed->no_free_path = 0;
+   ed->no_free_part = 0;
+   ed->path = NULL;
+   ed->part = NULL;
    ed->load_error = EDJE_LOAD_ERROR_NONE;
    return 1;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_main.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -3 -r1.44 -r1.45
--- edje_main.c 1 Oct 2005 04:15:15 -0000       1.44
+++ edje_main.c 28 Nov 2005 09:54:06 -0000      1.45
@@ -82,10 +82,16 @@
      }
    _edje_message_del(ed);
    _edje_file_del(ed);
-   if (ed->path) free(ed->path);
-   ed->path = NULL;
-   if (ed->part) free(ed->part);
-   ed->part = NULL;
+   if (ed->path)
+     {
+       if (!ed->no_free_path) free(ed->path);
+       ed->path = NULL;
+     }
+   if (ed->part)
+     {
+       if (!ed->no_free_part) free(ed->part);
+       ed->part = NULL;
+     }
    if ((ed->actions) || (ed->pending_actions))
      {
        _edje_animators = evas_list_remove(_edje_animators, ed);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -3 -r1.99 -r1.100
--- edje_private.h      26 Nov 2005 08:14:34 -0000      1.99
+++ edje_private.h      28 Nov 2005 09:54:06 -0000      1.100
@@ -474,6 +474,8 @@
    unsigned short        walking_actions : 1;
    unsigned short        block_break : 1;
    unsigned short        delete_me : 1;
+   unsigned short        no_free_path : 1;
+   unsigned short        no_free_part : 1;
    double                paused_at;
    Evas                 *evas; /* the Evas this Edje belongs to */
    Evas_Object          *obj; /* the smart object */




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to