Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        edje_cache.c edje_embryo.c edje_load.c edje_main.c 
        edje_private.h edje_text.c edje_util.c 


Log Message:


use stringshare! :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_cache.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- edje_cache.c        2 Nov 2005 08:13:56 -0000       1.3
+++ edje_cache.c        30 Nov 2005 09:56:14 -0000      1.4
@@ -57,7 +57,7 @@
        free(data);
      }
    
-   edc->part = strdup(coll);
+   edc->part = evas_stringshare_add(coll);
    edc->references = 1;
    edf->collection_hash = evas_hash_add(edf->collection_hash, coll, edc);
    return edc;
@@ -98,7 +98,7 @@
        return NULL;
      }
    
-   edf->path = strdup(file);
+   edf->path = evas_stringshare_add(file);
    edf->references = 1;
 
    _edje_textblock_style_parse_and_fix(edf);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_embryo.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- edje_embryo.c       24 Nov 2005 03:23:01 -0000      1.47
+++ edje_embryo.c       30 Nov 2005 09:56:14 -0000      1.48
@@ -279,13 +279,10 @@
          {
             char *ss;
             
-            ss = strdup(s);
-            if (ss)
-              {
-                 ss[params[3] - 1] = 0;
-                 SETSTR(ss, params[2]);
-                 free(ss);
-              }
+            ss = alloca(strlen(s));
+            strcpy(ss, s);
+            ss[params[3] - 1] = 0;
+            SETSTR(ss, params[2]);
          }
      }
    else
@@ -505,13 +502,10 @@
          {
             char *ss;
             
-            ss = strdup(s);
-            if (ss)
-              {
-                 ss[params[4] - 1] = 0;
-                 SETSTR(ss, params[3]);
-                 free(ss);
-              }
+            ss = alloca(strlen(s));
+            strcpy(ss, s);
+            ss[params[4] - 1] = 0;
+            SETSTR(ss, params[3]);
          }
      }
    else
@@ -855,13 +849,10 @@
               {
                  char *ss;
                  
-                 ss = strdup(s);
-                 if (ss)
-                   {
-                      ss[params[3] - 1] = 0;
-                      SETSTR(ss, params[2]);
-                      free(ss);
-                   }
+                 ss = alloca(strlen(s));
+                 strcpy(ss, s);
+                 ss[params[3] - 1] = 0;
+                 SETSTR(ss, params[2]);
               }
          }
        else
@@ -1033,13 +1024,10 @@
          {
             char *ss;
             
-            ss = strdup(s);
-            if (ss)
-              {
-                 ss[params[3] - 1] = 0;
-                 SETSTR(ss, params[2]);
-                 free(ss);
-              }
+            ss = alloca(strlen(s));
+            strcpy(ss, s);
+            ss[params[3] - 1] = 0;
+            SETSTR(ss, params[2]);
          }
      }
    else
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_load.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -3 -r1.78 -r1.79
--- edje_load.c 28 Nov 2005 09:54:06 -0000      1.78
+++ edje_load.c 30 Nov 2005 09:56:14 -0000      1.79
@@ -39,18 +39,10 @@
    
    _edje_file_del(ed);
    
-   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);
+   if (ed->path) evas_stringshare_del(ed->path);
+   if (ed->part) evas_stringshare_del(ed->part);
+   ed->path = evas_stringshare_add(file);
+   ed->part = evas_stringshare_add(part);
    
    ed->load_error = EDJE_LOAD_ERROR_NONE;
    _edje_file_add(ed);
@@ -145,10 +137,6 @@
             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;
@@ -330,25 +318,12 @@
        _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;
 }
@@ -573,8 +548,8 @@
               }
             if (rp->text.text) free(rp->text.text);
             if (rp->text.font) free(rp->text.font);
-            if (rp->text.cache.in_str) free(rp->text.cache.in_str);
-            if (rp->text.cache.out_str) free(rp->text.cache.out_str);       
+            if (rp->text.cache.in_str) 
evas_stringshare_del(rp->text.cache.in_str);
+            if (rp->text.cache.out_str) 
evas_stringshare_del(rp->text.cache.out_str);       
 
             if (rp->custom.description)
               {
@@ -692,7 +667,7 @@
        evas_hash_foreach(edf->collection_hash, 
_edje_file_collection_hash_foreach, edf);
        evas_hash_free(edf->collection_hash);
      }
-   if (edf->path) free(edf->path);
+   if (edf->path) evas_stringshare_del(edf->path);
    if (edf->compiler) free(edf->compiler);
    if (edf->collection_cache) _edje_cache_coll_flush(edf);
    _edje_textblock_style_cleanup(edf);
@@ -766,8 +741,7 @@
             free(edt);
          }
      }
-   if (ec->part)
-     free(ec->part);
+   if (ec->part) evas_stringshare_del(ec->part);
 #ifdef EDJE_PROGRAM_CACHE
    if (ec->prog_cache.no_matches) evas_hash_free(ec->prog_cache.no_matches);
    if (ec->prog_cache.matches)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_main.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- edje_main.c 28 Nov 2005 09:54:06 -0000      1.45
+++ edje_main.c 30 Nov 2005 09:56:14 -0000      1.46
@@ -82,16 +82,10 @@
      }
    _edje_message_del(ed);
    _edje_file_del(ed);
-   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->path) evas_stringshare_del(ed->path);
+   if (ed->part) evas_stringshare_del(ed->part);
+   ed->path = NULL;
+   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.100
retrieving revision 1.101
diff -u -3 -r1.100 -r1.101
--- edje_private.h      28 Nov 2005 09:54:06 -0000      1.100
+++ edje_private.h      30 Nov 2005 09:56:15 -0000      1.101
@@ -474,8 +474,6 @@
    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 */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_text.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- edje_text.c 26 Nov 2005 13:58:43 -0000      1.46
+++ edje_text.c 30 Nov 2005 09:56:15 -0000      1.47
@@ -364,8 +364,8 @@
    
        goto arrange_text;
      }
-   if (ep->text.cache.in_str) free(ep->text.cache.in_str);
-   ep->text.cache.in_str = strdup(text);
+   if (ep->text.cache.in_str) evas_stringshare_del(ep->text.cache.in_str);
+   ep->text.cache.in_str = evas_stringshare_add(text);
    ep->text.cache.in_size = size;
    if (chosen_desc->text.fit_x)
      {
@@ -479,8 +479,8 @@
                                &free_text);
      }
 
-   if (ep->text.cache.out_str) free(ep->text.cache.out_str);
-   ep->text.cache.out_str = strdup(text);
+   if (ep->text.cache.out_str) evas_stringshare_del(ep->text.cache.out_str);
+   ep->text.cache.out_str = evas_stringshare_add(text);
    ep->text.cache.in_w = sw;
    ep->text.cache.in_h = sh;
    ep->text.cache.out_size = size;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_util.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- edje_util.c 30 Nov 2005 08:37:37 -0000      1.67
+++ edje_util.c 30 Nov 2005 09:56:15 -0000      1.68
@@ -308,7 +308,7 @@
    Evas_List *members;
    Edje_Text_Class *tc;
 
-   return;
+   return; // this is broken right now - need to fix
    if (!text_class) return;
 
    if (size < 0) size = 0;
@@ -377,7 +377,7 @@
    Evas_List *l;
    Edje_Text_Class *tc;
 
-   return;
+   return; // this is broken right now. need to fix
 //   printf("------------ edje_object_text_class_set\n");
    ed = _edje_fetch(obj);
    if ((!ed) || (!text_class)) return;




-------------------------------------------------------
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