Remove use of evas_hash from evas and use directly eina.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 9 Dec 2008 17:56:31 +0000 (17:56 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 9 Dec 2008 17:56:31 +0000 (17:56 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@38066 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

15 files changed:
src/lib/Evas_Data.h
src/lib/cache/evas_cache.h
src/lib/cache/evas_cache_engine_image.c
src/lib/cache/evas_cache_image.c
src/lib/canvas/evas_font_dir.c
src/lib/canvas/evas_main.c
src/lib/canvas/evas_name.c
src/lib/engines/common/evas_font_draw.c
src/lib/engines/common/evas_font_load.c
src/lib/include/evas_common.h
src/lib/include/evas_private.h
src/modules/engines/xrender_x11/evas_engine_font.c
src/modules/engines/xrender_x11/evas_engine_image.c
src/modules/engines/xrender_xcb/evas_engine_font.c
src/modules/engines/xrender_xcb/evas_engine_image.c

index 357f166..41743c1 100644 (file)
@@ -102,29 +102,10 @@ extern "C" {
      return 255;
   }
 
-  static inline void *evas_hash_find(const Eina_Hash *hash, const void *key)
-  {
-     if (!hash) return NULL;
-     return eina_hash_find(hash, key);
-  }
-
-  static inline void *evas_hash_modify(Eina_Hash *hash, const void *key, const void *data)
-  {
-     if (!hash) return NULL;
-     return eina_hash_modify(hash, key, data);
-  }
-  static inline void evas_hash_free(Eina_Hash *hash)
-  {
-     if (!hash) return ;
-     eina_hash_free(hash);
-  }
-
-  static inline void evas_hash_foreach(const Eina_Hash *hash, Eina_Hash_Foreach cb, const void *fdata)
-  {
-     if (!hash) return;
-     eina_hash_foreach(hash, cb, fdata);
-  }
-
+  #define evas_hash_find eina_hash_find
+  #define evas_hash_modify eina_hash_modify
+  #define evas_hash_free eina_hash_free
+  #define evas_hash_foreach eina_hash_foreach
   #define evas_hash_alloc_error eina_error_get
 
   /*
index f3cee96..321cdd1 100644 (file)
@@ -50,8 +50,8 @@ struct _Evas_Cache_Image
 
    Eina_Inlist                  *lru;
    Eina_Inlist                  *lru_nodata;
-   Evas_Hash                    *inactiv;
-   Evas_Hash                    *activ;
+   Eina_Hash                    *inactiv;
+   Eina_Hash                    *activ;
    void                         *data;
 
    int                           usage;
@@ -87,11 +87,11 @@ struct _Evas_Cache_Engine_Image
 {
    Evas_Cache_Engine_Image_Func func;
 
-   Eina_Inlist*            dirty;
+   Eina_Inlist*                        dirty;
 
-   Evas_Hash*                   activ;
-   Evas_Hash*                   inactiv;
-   Eina_Inlist*            lru;
+   Eina_Hash*                   activ;
+   Eina_Hash*                   inactiv;
+   Eina_Inlist*                        lru;
 
    Evas_Cache_Image*            parent;
    Evas_Cache_Engine_Image*     brother;
index d048dc4..544a918 100644 (file)
@@ -26,7 +26,7 @@ _evas_cache_engine_image_make_active(Evas_Cache_Engine_Image *cache,
    eim->flags.cached = 1;
    eim->flags.activ = 1;
    eim->flags.dirty = 0;
-   cache->activ = evas_hash_add(cache->activ, key, eim);
+   eina_hash_add(cache->activ, key, eim);
 }
 
 static void
@@ -37,7 +37,7 @@ _evas_cache_engine_image_make_inactive(Evas_Cache_Engine_Image *cache,
    eim->flags.cached = 1;
    eim->flags.dirty = 0;
    eim->flags.activ = 0;
-   cache->inactiv = evas_hash_add(cache->inactiv, key, eim);
+   eina_hash_add(cache->inactiv, key, eim);
    cache->lru = eina_inlist_prepend(cache->lru, EINA_INLIST_GET(eim));
    cache->usage += cache->func.mem_size_get(eim);
 }
@@ -55,12 +55,12 @@ _evas_cache_engine_image_remove_activ(Evas_Cache_Engine_Image *cache,
         else
           if (eim->flags.activ)
             {
-               cache->activ = evas_hash_del(cache->activ, eim->cache_key, eim);
+              eina_hash_del(cache->activ, eim->cache_key, eim);
             }
           else
             {
                cache->usage -= cache->func.mem_size_get(eim);
-               cache->inactiv = evas_hash_del(cache->inactiv, eim->cache_key, eim);
+              eina_hash_del(cache->inactiv, eim->cache_key, eim);
                cache->lru = eina_inlist_remove(cache->lru, EINA_INLIST_GET(eim));
             }
         eim->flags.cached = 0;
@@ -185,8 +185,8 @@ evas_cache_engine_image_init(const Evas_Cache_Engine_Image_Func *cb, Evas_Cache_
 
    new->dirty = NULL;
    new->lru = NULL;
-   new->activ = NULL;
-   new->inactiv = NULL;
+   new->activ = eina_hash_string_superfast_new(NULL);
+   new->inactiv = eina_hash_string_superfast_new(NULL);
 
    new->parent = parent;
    parent->references++;
@@ -239,7 +239,7 @@ evas_cache_engine_image_dup(const Evas_Cache_Engine_Image_Func *cb, Evas_Cache_E
 }
 
 static Evas_Bool
-_evas_cache_engine_image_free_cb(__UNUSED__ const Evas_Hash *hash, __UNUSED__ const void *key, void *data, void *fdata)
+_evas_cache_engine_image_free_cb(__UNUSED__ const Eina_Hash *hash, __UNUSED__ const void *key, void *data, void *fdata)
 {
    Eina_List **delete_list = fdata;
 
@@ -272,8 +272,8 @@ evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache)
 
    if (cache->func.debug) cache->func.debug("shutdown-engine", NULL);
 
-   evas_hash_foreach(cache->inactiv, _evas_cache_engine_image_free_cb, &delete_list);
-   evas_hash_foreach(cache->activ, _evas_cache_engine_image_free_cb, &delete_list);
+   eina_hash_foreach(cache->inactiv, _evas_cache_engine_image_free_cb, &delete_list);
+   eina_hash_foreach(cache->activ, _evas_cache_engine_image_free_cb, &delete_list);
 
    while (delete_list)
      {
@@ -281,8 +281,8 @@ evas_cache_engine_image_shutdown(Evas_Cache_Engine_Image *cache)
        delete_list = eina_list_remove_list(delete_list, delete_list);
      }
 
-   evas_hash_free(cache->inactiv);
-   evas_hash_free(cache->activ);
+   eina_hash_free(cache->inactiv);
+   eina_hash_free(cache->activ);
 
    /* This is mad, I am about to destroy image still alive, but we need to prevent leak. */
    while (cache->dirty)
@@ -325,14 +325,14 @@ evas_cache_engine_image_request(Evas_Cache_Engine_Image *cache,
    if (!ekey)
      goto on_error;
 
-   eim = evas_hash_find(cache->activ, ekey);
+   eim = eina_hash_find(cache->activ, ekey);
    if (eim)
      {
         evas_cache_image_drop(im);
         goto on_ok;
      }
 
-   eim = evas_hash_find(cache->inactiv, ekey);
+   eim = eina_hash_find(cache->inactiv, ekey);
    if (eim)
      {
         _evas_cache_engine_image_remove_activ(cache, eim);
index bc9c328..be6dc60 100644 (file)
@@ -72,7 +72,7 @@ _evas_cache_image_make_activ(Evas_Cache_Image *cache,
         im->flags.activ = 1;
         im->flags.lru_nodata = 0;
         im->flags.dirty = 0;
-        cache->activ = evas_hash_direct_add(cache->activ, key, im);
+       eina_hash_direct_add(cache->activ, key, im);
      }
    else
      {
@@ -90,7 +90,7 @@ _evas_cache_image_make_inactiv(Evas_Cache_Image *cache,
        im->flags.activ = 0;
        im->flags.dirty = 0;
        im->flags.cached = 1;
-       cache->inactiv = evas_hash_direct_add(cache->inactiv, key, im);
+       eina_hash_direct_add(cache->inactiv, key, im);
        cache->lru = eina_inlist_prepend(cache->lru, EINA_INLIST_GET(im));
        cache->usage += cache->func.mem_size_get(im);
      }
@@ -130,7 +130,7 @@ _evas_cache_image_remove_activ(Evas_Cache_Image *cache,
      {
         if (ie->flags.activ)
           {
-             cache->activ = evas_hash_del(cache->activ, ie->cache_key, ie);
+            eina_hash_del(cache->activ, ie->cache_key, ie);
              _evas_cache_image_remove_lru_nodata(cache, ie);
           }
         else
@@ -141,7 +141,7 @@ _evas_cache_image_remove_activ(Evas_Cache_Image *cache,
                }
              else
                {
-                  cache->inactiv = evas_hash_del(cache->inactiv, ie->cache_key, ie);
+                 eina_hash_del(cache->inactiv, ie->cache_key, ie);
                   cache->lru = eina_inlist_remove(cache->lru, EINA_INLIST_GET(ie));
                   cache->usage -= cache->func.mem_size_get(ie);
                }
@@ -377,8 +377,8 @@ evas_cache_image_init(const Evas_Cache_Image_Func *cb)
    new->dirty = NULL;
    new->lru = NULL;
    new->lru_nodata = NULL;
-   new->inactiv = NULL;
-   new->activ = NULL;
+   new->inactiv = eina_hash_string_superfast_new(NULL);
+   new->activ = eina_hash_string_superfast_new(NULL);
 
    new->references = 1;
 
@@ -386,7 +386,7 @@ evas_cache_image_init(const Evas_Cache_Image_Func *cb)
 }
 
 static Evas_Bool
-_evas_cache_image_free_cb(__UNUSED__ const Evas_Hash *hash, __UNUSED__ const void *key, void *data, void *fdata)
+_evas_cache_image_free_cb(__UNUSED__ const Eina_Hash *hash, __UNUSED__ const void *key, void *data, void *fdata)
 {
    Eina_List **delete_list = fdata;
 
@@ -426,7 +426,7 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
         _evas_cache_image_entry_delete(cache, im);
      }
 
-   evas_hash_foreach(cache->activ, _evas_cache_image_free_cb, &delete_list);
+   eina_hash_foreach(cache->activ, _evas_cache_image_free_cb, &delete_list);
 
    while (delete_list)
      {
@@ -434,8 +434,8 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
        delete_list = eina_list_remove_list(delete_list, delete_list);
      }
 
-   evas_hash_free(cache->activ);
-   evas_hash_free(cache->inactiv);
+   eina_hash_free(cache->activ);
+   eina_hash_free(cache->inactiv);
 
    free(cache);
 }
@@ -514,7 +514,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
 
    hkey[size] = '\0';
 
-   im = evas_hash_find(cache->activ, hkey);
+   im = eina_hash_find(cache->activ, hkey);
    if (im)
      {
         time_t  t;
@@ -537,7 +537,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
        _evas_cache_image_make_dirty(cache, im);
      }
 
-   im = evas_hash_find(cache->inactiv, hkey);
+   im = eina_hash_find(cache->inactiv, hkey);
    if (im)
      {
         int     ok;
index cf7f0c7..2b473ce 100644 (file)
@@ -19,7 +19,7 @@
 #endif
 
 /* font dir cache */
-static Evas_Hash *font_dirs = NULL;
+static Eina_Hash *font_dirs = NULL;
 static Eina_List *fonts_cache = NULL;
 static Eina_List *fonts_zero = NULL;
 
@@ -35,7 +35,7 @@ struct _Fndat
 };
 
 /* private methods for font dir cache */
-static Evas_Bool font_cache_dir_free(const Evas_Hash *hash, const void *key, void *data, void *fdata);
+static Evas_Bool font_cache_dir_free(const Eina_Hash *hash, const void *key, void *data, void *fdata);
 static Evas_Font_Dir *object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd);
 static Evas_Font *object_text_font_cache_font_find_x(Evas_Font_Dir *fd, char *font);
 static Evas_Font *object_text_font_cache_font_find_file(Evas_Font_Dir *fd, char *font);
@@ -50,17 +50,18 @@ evas_font_dir_cache_free(void)
 {
    if (!font_dirs) return;
 
-   evas_hash_foreach(font_dirs, font_cache_dir_free, NULL);
-   evas_hash_free(font_dirs);
+   eina_hash_foreach(font_dirs, font_cache_dir_free, NULL);
+   eina_hash_free(font_dirs);
    font_dirs = NULL;
 }
 
 const char *
 evas_font_dir_cache_find(char *dir, char *font)
 {
-   Evas_Font_Dir *fd;
+   Evas_Font_Dir *fd = NULL;
 
-   fd = evas_hash_find(font_dirs, dir);
+   if (!font_dirs) font_dirs = eina_hash_string_superfast_new(NULL);
+   else fd = eina_hash_find(font_dirs, dir);
    fd = object_text_font_cache_dir_update(dir, fd);
    if (fd)
      {
@@ -435,11 +436,13 @@ evas_font_dir_available_list(const Evas *evas)
    if (!evas->font_path)
      return available;
 
+   if (!font_dirs) font_dirs = eina_hash_string_superfast_new(NULL);
+
    EINA_LIST_FOREACH(evas->font_path, l, dir)
      {
        Evas_Font_Dir *fd;
 
-       fd = evas_hash_find(font_dirs, dir);
+       fd = eina_hash_find(font_dirs, dir);
        fd = object_text_font_cache_dir_update(dir, fd);
        if (fd && fd->aliases)
          {
@@ -465,7 +468,7 @@ evas_font_dir_available_list_free(Eina_List *available)
 
 /* private stuff */
 static Eina_Bool
-font_cache_dir_free(const Evas_Hash *hash, const void *key, void *data, void *fdata)
+font_cache_dir_free(const Eina_Hash *hash, const void *key, void *data, void *fdata)
 {
    object_text_font_cache_dir_del((char *) key, data);
    return 1;
@@ -483,7 +486,7 @@ object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd)
        if (mt != fd->dir_mod_time)
          {
             object_text_font_cache_dir_del(dir, fd);
-            font_dirs = evas_hash_del(font_dirs, dir, fd);
+            eina_hash_del(font_dirs, dir, fd);
          }
        else
          {
@@ -495,7 +498,7 @@ object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd)
                  if (mt != fd->fonts_dir_mod_time)
                    {
                       object_text_font_cache_dir_del(dir, fd);
-                      font_dirs = evas_hash_del(font_dirs, dir, fd);
+                      eina_hash_del(font_dirs, dir, fd);
                    }
                  else
                    {
@@ -508,7 +511,7 @@ object_text_font_cache_dir_update(char *dir, Evas_Font_Dir *fd)
                       if (mt != fd->fonts_alias_mod_time)
                         {
                            object_text_font_cache_dir_del(dir, fd);
-                           font_dirs = evas_hash_del(font_dirs, dir, fd);
+                           eina_hash_del(font_dirs, dir, fd);
                         }
                       else
                         return fd;
@@ -584,13 +587,13 @@ object_text_font_cache_font_find(Evas_Font_Dir *fd, char *font)
 {
    Evas_Font *fn;
 
-   fn = evas_hash_find(fd->lookup, font);
+   fn = eina_hash_find(fd->lookup, font);
    if (fn) return fn;
    fn = object_text_font_cache_font_find_alias(fd, font);
    if (!fn) fn = object_text_font_cache_font_find_x(fd, font);
    if (!fn) fn = object_text_font_cache_font_find_file(fd, font);
    if (!fn) return NULL;
-   fd->lookup = evas_hash_add(fd->lookup, font, fn);
+   eina_hash_add(fd->lookup, font, fn);
    return fn;
 }
 
@@ -600,10 +603,13 @@ object_text_font_cache_dir_add(char *dir)
    Evas_Font_Dir *fd;
    char *tmp, *tmp2;
    Eina_List *fdir;
+   Evas_Font *fn;
 
    fd = calloc(1, sizeof(Evas_Font_Dir));
    if (!fd) return NULL;
-   font_dirs = evas_hash_add(font_dirs, dir, fd);
+   fd->lookup = eina_hash_string_superfast_new(NULL);
+
+   eina_hash_add(font_dirs, dir, fd);
 
    /* READ fonts.alias, fonts.dir and directory listing */
 
@@ -632,8 +638,6 @@ object_text_font_cache_dir_add(char *dir)
                  num = evas_object_text_font_string_parse((char *)fdef, font_prop);
                  if (num == 14)
                    {
-                      Evas_Font *fn;
-
                       fn = calloc(1, sizeof(Evas_Font));
                       if (fn)
                         {
@@ -663,8 +667,6 @@ object_text_font_cache_dir_add(char *dir)
        tmp = evas_file_path_join(dir, fdir->data);
        if (tmp)
          {
-            Evas_Font *fn;
-
             fn = calloc(1, sizeof(Evas_Font));
             if (fn)
               {
@@ -747,7 +749,7 @@ object_text_font_cache_dir_add(char *dir)
 static void
 object_text_font_cache_dir_del(char *dir, Evas_Font_Dir *fd)
 {
-   if (fd->lookup) evas_hash_free(fd->lookup);
+   if (fd->lookup) eina_hash_free(fd->lookup);
    while (fd->fonts)
      {
        Evas_Font *fn;
index f4250d6..9a7d9c8 100644 (file)
@@ -68,6 +68,7 @@ evas_new(void)
    e->viewport.w = 1;
    e->viewport.h = 1;
    e->hinting = EVAS_FONT_HINTING_BYTECODE;
+   e->name_hash = eina_hash_string_superfast_new(NULL);
 
    eina_array_step_set(&e->delete_objects, 16);
    eina_array_step_set(&e->active_objects, 16);
@@ -141,7 +142,8 @@ evas_free(Evas *e)
    evas_font_path_clear(e);
    e->pointer.object.in = eina_list_free(e->pointer.object.in);
 
-   if (e->name_hash) evas_hash_free(e->name_hash);
+   if (e->name_hash) eina_hash_free(e->name_hash);
+   e->name_hash = NULL;
 
    while (e->damages)
      {
index 447c5ae..92bb187 100644 (file)
@@ -19,14 +19,14 @@ evas_object_name_set(Evas_Object *obj, const char *name)
    MAGIC_CHECK_END();
    if (obj->name)
      {
-       obj->layer->evas->name_hash = evas_hash_del(obj->layer->evas->name_hash, obj->name, obj);
+       eina_hash_del(obj->layer->evas->name_hash, obj->name, obj);
        free(obj->name);
      }
    if (!name) obj->name = NULL;
    else
      {
        obj->name = strdup(name);
-       obj->layer->evas->name_hash = evas_hash_add(obj->layer->evas->name_hash, obj->name, obj);
+       eina_hash_add(obj->layer->evas->name_hash, obj->name, obj);
      }
 }
 
@@ -59,7 +59,7 @@ evas_object_name_find(const Evas *e, const char *name)
    return NULL;
    MAGIC_CHECK_END();
    if (!name) return NULL;
-   return (Evas_Object *)evas_hash_find(e->name_hash, name);
+   return (Evas_Object *)eina_hash_find(e->name_hash, name);
 }
 
 /**
index bb2039e..9efaf45 100644 (file)
@@ -9,7 +9,6 @@ EAPI RGBA_Font_Glyph *
 evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt index)
 {
    RGBA_Font_Glyph *fg;
-   char key[6];
    FT_UInt hindex;
    FT_Error error;
    const FT_Int32 hintflags[3] =
@@ -17,14 +16,7 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt index)
 
    hindex = index + (fi->hinting * 500000000);
 
-   key[0] = ((hindex       ) & 0x7f) + 1;
-   key[1] = ((hindex >> 7  ) & 0x7f) + 1;
-   key[2] = ((hindex >> 14 ) & 0x7f) + 1;
-   key[3] = ((hindex >> 21 ) & 0x7f) + 1;
-   key[4] = ((hindex >> 28 ) & 0x0f) + 1;
-   key[5] = 0;
-
-   fg = evas_hash_find(fi->glyphs, key);
+   fg = eina_hash_find(fi->glyphs, &hindex);
    if (fg) return fg;
 
 //   error = FT_Load_Glyph(fi->src->ft.face, index, FT_LOAD_NO_BITMAP);
@@ -54,7 +46,7 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt index)
      }
    fg->glyph_out = (FT_BitmapGlyph)fg->glyph;
 
-   fi->glyphs = evas_hash_add(fi->glyphs, key, fg);
+   eina_hash_add(fi->glyphs, &hindex, fg);
    return fg;
 }
 
index 9f3c841..fae7caf 100644 (file)
@@ -12,8 +12,8 @@ static int                font_cache = 0;
 static Eina_Inlist * fonts_src = NULL;
 static Eina_Inlist * fonts = NULL;
 
-static Evas_Bool font_modify_cache_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata);
-static Evas_Bool font_flush_free_glyph_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata);
+static Evas_Bool font_modify_cache_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
+static Evas_Bool font_flush_free_glyph_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
 
 EAPI RGBA_Font_Source *
 evas_common_font_source_memory_load(const char *name, const void *data, int data_size)
@@ -197,10 +197,11 @@ EAPI RGBA_Font_Int *
 evas_common_font_int_load_init(RGBA_Font_Int *fi)
 {
    fi->ft.size = NULL;
-   fi->glyphs = NULL;
+   fi->glyphs = eina_hash_int32_new(NULL);
    fi->usage = 0;
    fi->references = 1;
    fonts = eina_inlist_prepend(fonts, EINA_INLIST_GET(fi));
+
    return fi;
 }
 
@@ -363,16 +364,14 @@ EAPI void
 evas_common_font_free(RGBA_Font *fn)
 {
    Eina_List *l;
+   RGBA_Font_Int *fi;
 
    if (!fn)
       return;
    fn->references--;
    if (fn->references > 0) return;
-   for (l = fn->fonts; l; l = l->next)
+   EINA_LIST_FOREACH(fn->fonts, l, fi)
      {
-       RGBA_Font_Int *fi;
-
-       fi = l->data;
        fi->references--;
        if (fi->references == 0)
          {
@@ -389,17 +388,13 @@ EAPI void
 evas_common_font_hinting_set(RGBA_Font *fn, Font_Hint_Flags hinting)
 {
    Eina_List *l;
+   RGBA_Font_Int *fi;
 
    if (!fn)
      return;
    fn->hinting = hinting;
-   for (l = fn->fonts; l; l = l->next)
-     {
-       RGBA_Font_Int *fi;
-
-       fi = l->data;
-       fi->hinting = fn->hinting;
-     }
+   EINA_LIST_FOREACH(fn->fonts, l, fi)
+     fi->hinting = fn->hinting;
 }
 
 EAPI Evas_Bool
@@ -473,8 +468,8 @@ evas_common_font_memory_hinting_add(RGBA_Font *fn, const char *name, int size, c
    return fn;
 }
 
-static Evas_Bool
-font_modify_cache_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata)
+static Eina_Bool
+font_modify_cache_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
 {
    int *dir;
    RGBA_Font_Glyph *fg;
@@ -498,8 +493,8 @@ evas_common_font_int_modify_cache_by(RGBA_Font_Int *fi, int dir)
 {
    int sz_hash = 0;
 
-   if (fi->glyphs) sz_hash = evas_hash_size(fi->glyphs);
-   evas_hash_foreach(fi->glyphs, font_modify_cache_cb, &dir);
+   if (fi->glyphs) sz_hash = eina_hash_population(fi->glyphs);
+   eina_hash_foreach(fi->glyphs, font_modify_cache_cb, &dir);
    font_cache_usage += dir * (sizeof(RGBA_Font) + sz_hash +
                              sizeof(FT_FaceRec) + 16384); /* fudge values */
 }
@@ -524,8 +519,8 @@ evas_common_font_flush(void)
    while (font_cache_usage > font_cache) evas_common_font_flush_last();
 }
 
-static Evas_Bool
-font_flush_free_glyph_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata)
+static Eina_Bool
+font_flush_free_glyph_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
 {
    RGBA_Font_Glyph *fg;
 
@@ -560,8 +555,8 @@ evas_common_font_flush_last(void)
    fonts = eina_inlist_remove(fonts, EINA_INLIST_GET(fi));
    evas_common_font_int_modify_cache_by(fi, -1);
 
-   evas_hash_foreach(fi->glyphs, font_flush_free_glyph_cb, NULL);
-   evas_hash_free(fi->glyphs);
+   eina_hash_foreach(fi->glyphs, font_flush_free_glyph_cb, NULL);
+   eina_hash_free(fi->glyphs);
 
    evas_common_font_source_free(fi->src);
 
index 59f3834..651de58 100644 (file)
@@ -629,7 +629,7 @@ struct _RGBA_Font_Int
       FT_Size       size;
    } ft;
 
-   Evas_Hash       *glyphs;
+   Eina_Hash       *glyphs;
 
    int              usage;
    Font_Hint_Flags hinting;
index becf247..009afc7 100644 (file)
@@ -270,7 +270,7 @@ struct _Evas
 
    Evas_Layer       *layers;
 
-   Evas_Hash        *name_hash;
+   Eina_Hash        *name_hash;
 
    int               output_validity;
 
@@ -479,7 +479,7 @@ struct _Evas_Data_Node
 
 struct _Evas_Font_Dir
 {
-   Evas_Hash *lookup;
+   Eina_Hash *lookup;
    Eina_List *fonts;
    Eina_List *aliases;
    DATA64     dir_mod_time;
index 3f191d2..11c0b20 100644 (file)
@@ -3,20 +3,20 @@
 #include "evas_engine.h"
 #include "Evas_Engine_XRender_X11.h"
 
-static Evas_Hash *_xr_fg_pool = NULL;
+static Eina_Hash *_xr_fg_pool = NULL;
 
 XR_Font_Surface *
 _xre_font_surface_new(Ximage_Info *xinf, RGBA_Font_Glyph *fg)
-{    
+{
    XR_Font_Surface *fs;
    DATA8 *data;
    int w, h, j;
    XRenderPictureAttributes att;
    XRenderPictFormat *fmt;
    Ximage_Image  *xim;
-   Evas_Hash *pool;
+   Eina_Hash *pool;
    char buf[256], buf2[256];
-   
+
    data = fg->glyph_out->bitmap.buffer;
    w = fg->glyph_out->bitmap.width;
    h = fg->glyph_out->bitmap.rows;
@@ -30,11 +30,11 @@ _xre_font_surface_new(Ximage_Info *xinf, RGBA_Font_Glyph *fg)
        if ((fs->xinf->disp == xinf->disp) && (fs->xinf->root == xinf->root))
          return fs;
        snprintf(buf, sizeof(buf), "@%p@/@%lx@", fs->xinf->disp, fs->xinf->root);
-       pool = evas_hash_find(_xr_fg_pool, buf);
+       pool = eina_hash_find(_xr_fg_pool, buf);
        if (pool)
          {
             snprintf(buf, sizeof(buf), "%p", fg);
-            fs = evas_hash_find(pool, buf);
+            fs = eina_hash_find(pool, buf);
             if (fs) return fs;
          }
      }
@@ -47,12 +47,14 @@ _xre_font_surface_new(Ximage_Info *xinf, RGBA_Font_Glyph *fg)
    fs->xinf->references++;
    fs->w = w;
    fs->h = h;
-   
+
    snprintf(buf, sizeof(buf), "@%p@/@%lx@", fs->xinf->disp, fs->xinf->root);
-   pool = evas_hash_find(_xr_fg_pool, buf);
+   pool = eina_hash_find(_xr_fg_pool, buf);
+   if (!pool) pool = eina_hash_string_superfast_new(NULL);
    snprintf(buf2, sizeof(buf2), "%p", fg);
-   pool = evas_hash_add(pool, buf2, fs);
-   _xr_fg_pool = evas_hash_add(_xr_fg_pool, buf, pool);
+   eina_hash_add(pool, buf2, fs);
+   if (!_xr_fg_pool) _xr_fg_pool = eina_hash_string_superfast_new(NULL);
+   eina_hash_add(_xr_fg_pool, buf, pool);
 
    /* FIXME: maybe use fmt4? */
    fmt = xinf->fmt8;
@@ -60,9 +62,9 @@ _xre_font_surface_new(Ximage_Info *xinf, RGBA_Font_Glyph *fg)
    att.dither = 0;
    att.component_alpha = 0;
    att.repeat = 0;
-   fs->pic = XRenderCreatePicture(xinf->disp, fs->draw,fmt, 
+   fs->pic = XRenderCreatePicture(xinf->disp, fs->draw,fmt,
                                  CPRepeat | CPDither | CPComponentAlpha, &att);
-   
+
    /* FIXME: handle if fmt->depth != 8 */
    xim = _xr_image_new(fs->xinf, w, h,fmt->depth);
    if ((fg->glyph_out->bitmap.num_grays == 256) &&
@@ -127,17 +129,18 @@ _xre_font_surface_new(Ximage_Info *xinf, RGBA_Font_Glyph *fg)
 }
 
 static Evas_Bool
-_xre_font_pool_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata)
+_xre_font_pool_cb(const Eina_Hash *hash, const char *key, void *data, void *fdata)
 {
-   Evas_Hash *pool;
+   Eina_Hash *pool;
    XR_Font_Surface *fs;
    char buf[256];
-   
+
    fs = fdata;
    pool = data;
    snprintf(buf, sizeof(buf), "@%p@/@%lx@", fs->xinf->disp, fs->xinf->root);
-   pool = evas_hash_del(pool, buf, fs);
-   hash = evas_hash_modify(hash, key, pool);
+   eina_hash_del(pool, buf, fs);
+   if (!hash) hash = eina_hash_string_superfast_new(NULL);
+   eina_hash_modify(hash, key, pool);
    return 1;
 }
 
@@ -145,7 +148,7 @@ void
 _xre_font_surface_free(XR_Font_Surface *fs)
 {
    if (!fs) return;
-   evas_hash_foreach(_xr_fg_pool, _xre_font_pool_cb, fs);
+   eina_hash_foreach(_xr_fg_pool, _xre_font_pool_cb, fs);
    XFreePixmap(fs->xinf->disp, fs->draw);
    XRenderFreePicture(fs->xinf->disp, fs->pic);
    _xr_image_info_free(fs->xinf);
index 606bd38..1680b45 100644 (file)
@@ -3,58 +3,60 @@
 #include "evas_engine.h"
 #include "Evas_Engine_XRender_X11.h"
 
-static Evas_Hash *_xr_image_hash        = NULL;
+static Eina_Hash *_xr_image_hash        = NULL;
 static int        _xr_image_cache_size  = 0;
 static int        _xr_image_cache_usage = 0;
 static Eina_List *_xr_image_cache       = NULL;
-static Evas_Hash *_xr_image_dirty_hash  = NULL;
+static Eina_Hash *_xr_image_dirty_hash  = NULL;
 
 static void
 __xre_image_dirty_hash_add(XR_Image *im)
 {
    char buf[64];
-   
+
    if (!im->data) return;
    snprintf(buf, sizeof(buf), "%p", im->data);
-   _xr_image_dirty_hash = evas_hash_add(_xr_image_dirty_hash, buf, im);
+   if (!_xr_image_dirty_hash) _xr_image_dirty_hash = eina_hash_string_superfast_new(NULL);
+   eina_hash_add(_xr_image_dirty_hash, buf, im);
 }
 
 static void
 __xre_image_dirty_hash_del(XR_Image *im)
 {
    char buf[64];
-   
+
    if (!im->data) return;
    snprintf(buf, sizeof(buf), "%p", im->data);
-   _xr_image_dirty_hash = evas_hash_del(_xr_image_dirty_hash, buf, im);
+   eina_hash_del(_xr_image_dirty_hash, buf, im);
 }
 
 static XR_Image *
 __xre_image_dirty_hash_find(void *data)
 {
    char buf[64];
-   
+
    snprintf(buf, sizeof(buf), "%p", data);
-   return evas_hash_find(_xr_image_dirty_hash, buf);
+   return eina_hash_find(_xr_image_dirty_hash, buf);
 }
 
 static XR_Image *
 __xre_image_find(char *fkey)
 {
    XR_Image *im;
-   
-   im = evas_hash_find(_xr_image_hash, fkey);
+
+   im = eina_hash_find(_xr_image_hash, fkey);
    if (!im)
      {
        Eina_List *l;
-       
+
        for (l = _xr_image_cache; l; l = l->next)
          {
             im = l->data;
             if (!strcmp(im->fkey, fkey))
               {
                  _xr_image_cache = eina_list_remove_list(_xr_image_cache, l);
-                 _xr_image_hash = evas_hash_add(_xr_image_hash, im->fkey, im);
+                 if (!_xr_image_hash) _xr_image_hash = eina_hash_string_superfast_new(NULL);
+                 eina_hash_add(_xr_image_hash, im->fkey, im);
                  _xr_image_cache_usage -= (im->w * im->h * 4);
                  break;
               }
@@ -91,7 +93,7 @@ _xre_image_load(Ximage_Info *xinf, const char *file, const char *key, Evas_Image
      {
        return im;
      }
-   
+
    im = calloc(1, sizeof(XR_Image));
    if (!im) return NULL;
    im->im = evas_common_load_image_from_file(file, key, lo);
@@ -113,7 +115,8 @@ _xre_image_load(Ximage_Info *xinf, const char *file, const char *key, Evas_Image
    if (im->im->info.comment) im->comment = eina_stringshare_add(im->im->info.comment);
 //   if (im->im->info.format == 1) im->format = eina_stringshare_add("png");
    if (im->im->cache_entry.flags.alpha) im->alpha = 1;
-   _xr_image_hash = evas_hash_direct_add(_xr_image_hash, im->fkey, im);
+   if (!_xr_image_hash) _xr_image_hash = eina_hash_string_superfast_new(NULL);
+   eina_hash_direct_add(_xr_image_hash, im->fkey, im);
    return im;
 }
 
@@ -170,7 +173,7 @@ _xre_image_new_from_copied_data(Ximage_Info *xinf, int w, int h, void *data, int
        if (data)
          {
             Gfx_Func_Copy func;
-            
+
             func = evas_common_draw_func_copy_get(w * h, 0);
             if (func) func(data, im->data, w * h);
             evas_common_cpu_end_opt();
@@ -254,7 +257,7 @@ _xre_image_free(XR_Image *im)
    if (!im->dirty)
      {
        if (im->fkey)
-         _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+         eina_hash_del(_xr_image_hash, im->fkey, im);
        _xr_image_cache = eina_list_prepend(_xr_image_cache, im);
        _xr_image_cache_usage += (im->w * im->h * 4);
        _xre_image_cache_set(_xr_image_cache_size);
@@ -282,7 +285,7 @@ _xre_image_dirty(XR_Image *im)
 {
    if (im->dirty) return;
    if (im->fkey)
-     _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+     eina_hash_del(_xr_image_hash, im->fkey, im);
    im->dirty = 1;
    __xre_image_dirty_hash_add(im);
 }
@@ -463,7 +466,7 @@ _xre_image_data_put(XR_Image *im, void *data)
    if (!im->dirty)
      {
        if (im->fkey)
-         _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+         eina_hash_del(_xr_image_hash, im->fkey, im);
        im->dirty = 1;
      }
    if (im->updates)
index 5c9aeae..3c4a1a3 100644 (file)
@@ -3,21 +3,21 @@
 #include "evas_engine.h"
 #include "Evas_Engine_XRender_Xcb.h"
 
-static Evas_Hash *_xr_fg_pool = NULL;
+static Eina_Hash *_xr_fg_pool = NULL;
 
 XR_Font_Surface *
 _xre_font_surface_new(Xcb_Image_Info *xcbinf, RGBA_Font_Glyph *fg)
-{    
+{
    char             buf[256];
    char             buf2[256];
    XR_Font_Surface *fs;
    DATA8           *data;
    int              w, h, j;
    Xcb_Image_Image *xcim;
-   Evas_Hash       *pool;
+   Eina_Hash       *pool;
    uint32_t         mask;
    uint32_t         values[3];
-   
+
    data = fg->glyph_out->bitmap.buffer;
    w = fg->glyph_out->bitmap.width;
    h = fg->glyph_out->bitmap.rows;
@@ -32,11 +32,11 @@ _xre_font_surface_new(Xcb_Image_Info *xcbinf, RGBA_Font_Glyph *fg)
             (fs->xcbinf->root == xcbinf->root))
          return fs;
        snprintf(buf, sizeof(buf), "@%p@/@%x@", fs->xcbinf->conn, fs->xcbinf->root);
-       pool = evas_hash_find(_xr_fg_pool, buf);
+       pool = eina_hash_find(_xr_fg_pool, buf);
        if (pool)
          {
             snprintf(buf, sizeof(buf), "%p", fg);
-            fs = evas_hash_find(pool, buf);
+            fs = eina_hash_find(pool, buf);
             if (fs) return fs;
          }
      }
@@ -49,12 +49,14 @@ _xre_font_surface_new(Xcb_Image_Info *xcbinf, RGBA_Font_Glyph *fg)
    fs->xcbinf->references++;
    fs->w = w;
    fs->h = h;
-   
+
    snprintf(buf, sizeof(buf), "@%p@/@%x@", fs->xcbinf->conn, fs->xcbinf->root);
-   pool = evas_hash_find(_xr_fg_pool, buf);
+   pool = eina_hash_find(_xr_fg_pool, buf);
+   if (!pool) pool = eina_hash_string_superfast_new(NULL);
    snprintf(buf2, sizeof(buf2), "%p", fg);
-   pool = evas_hash_add(pool, buf2, fs);
-   _xr_fg_pool = evas_hash_add(_xr_fg_pool, buf, pool);
+   eina_hash_add(pool, buf2, fs);
+   if (!_xr_fg_pool) _xr_fg_pool = eina_hash_string_superfast_new(NULL);
+   eina_hash_add(_xr_fg_pool, buf, pool);
 
    fs->draw = xcb_generate_id(xcbinf->conn);
    xcb_create_pixmap(xcbinf->conn, xcbinf->fmt8->depth, fs->draw, xcbinf->root, w, h);
@@ -129,17 +131,18 @@ _xre_font_surface_new(Xcb_Image_Info *xcbinf, RGBA_Font_Glyph *fg)
 }
 
 static Evas_Bool
-_xre_font_pool_cb(const Evas_Hash *hash, const char *key, void *data, void *fdata)
+_xre_font_pool_cb(const Eina_Hash *hash, const char *key, void *data, void *fdata)
 {
    char             buf[256];
-   Evas_Hash       *pool;
+   Eina_Hash       *pool;
    XR_Font_Surface *fs;
-   
+
    fs = fdata;
    pool = data;
    snprintf(buf, sizeof(buf), "@%p@/@%x@", fs->xcbinf->conn, fs->xcbinf->root);
-   pool = evas_hash_del(pool, buf, fs);
-   hash = evas_hash_modify(hash, key, pool);
+   eina_hash_del(pool, buf, fs);
+   if (!hash) hash = eina_hash_string_superfast_new(NULL);
+   eina_hash_modify(hash, key, pool);
    return 1;
 }
 
@@ -147,7 +150,7 @@ void
 _xre_font_surface_free(XR_Font_Surface *fs)
 {
    if (!fs) return;
-   evas_hash_foreach(_xr_fg_pool, _xre_font_pool_cb, fs);
+   eina_hash_foreach(_xr_fg_pool, _xre_font_pool_cb, fs);
    xcb_free_pixmap(fs->xcbinf->conn, fs->draw);
    xcb_render_free_picture(fs->xcbinf->conn, fs->pic);
    _xr_image_info_free(fs->xcbinf);
index f00d046..e461da8 100644 (file)
@@ -3,11 +3,11 @@
 #include "evas_engine.h"
 #include "Evas_Engine_XRender_Xcb.h"
 
-static Evas_Hash *_xr_image_hash        = NULL;
+static Eina_Hash *_xr_image_hash        = NULL;
 static int        _xr_image_cache_size  = 0;
 static int        _xr_image_cache_usage = 0;
 static Eina_List *_xr_image_cache       = NULL;
-static Evas_Hash *_xr_image_dirty_hash  = NULL;
+static Eina_Hash *_xr_image_dirty_hash  = NULL;
 
 static void
 __xre_image_dirty_hash_add(XR_Image *im)
@@ -16,7 +16,8 @@ __xre_image_dirty_hash_add(XR_Image *im)
    
    if (!im->data) return;
    snprintf(buf, sizeof(buf), "%p", im->data);
-   _xr_image_dirty_hash = evas_hash_add(_xr_image_dirty_hash, buf, im);
+   if (!_xr_image_dirty_hash) _xr_image_dirty_hash = eina_hash_string_superfast_new(NULL);
+   eina_hash_add(_xr_image_dirty_hash, buf, im);
 }
 
 static void
@@ -26,7 +27,7 @@ __xre_image_dirty_hash_del(XR_Image *im)
    
    if (!im->data) return;
    snprintf(buf, sizeof(buf), "%p", im->data);
-   _xr_image_dirty_hash = evas_hash_del(_xr_image_dirty_hash, buf, im);
+   eina_hash_del(_xr_image_dirty_hash, buf, im);
 }
 
 static XR_Image *
@@ -35,7 +36,7 @@ __xre_image_dirty_hash_find(void *data)
    char buf[64];
    
    snprintf(buf, sizeof(buf), "%p", data);
-   return evas_hash_find(_xr_image_dirty_hash, buf);
+   return eina_hash_find(_xr_image_dirty_hash, buf);
 }
 
 static XR_Image *
@@ -43,7 +44,7 @@ __xre_image_find(char *fkey)
 {
    XR_Image *im;
 
-   im = evas_hash_find(_xr_image_hash, fkey);
+   im = eina_hash_find(_xr_image_hash, fkey);
    if (!im)
      {
        Eina_List *l;
@@ -53,7 +54,8 @@ __xre_image_find(char *fkey)
             if (!strcmp(im->fkey, fkey))
               {
                  _xr_image_cache = eina_list_remove_list(_xr_image_cache, l);
-                 _xr_image_hash = evas_hash_add(_xr_image_hash, im->fkey, im);
+                 if (!_xr_image_hash) _xr_image_hash = eina_hash_string_superfast_new(NULL);
+                 eina_hash_add(_xr_image_hash, im->fkey, im);
                  _xr_image_cache_usage -= (im->w * im->h * 4);
                  break;
               }
@@ -111,7 +113,8 @@ _xre_image_load(Xcb_Image_Info *xcbinf, const char *file, const char *key, Evas_
    if (im->im->info.comment) im->comment = (char *)eina_stringshare_add(im->im->info.comment);
 /*    if (im->im->info.format == 1) im->format = eina_stringshare_add("png"); */
    if (im->im->cache_entry.flags.alpha) im->alpha = 1;
-   _xr_image_hash = evas_hash_direct_add(_xr_image_hash, im->fkey, im);
+   if (!_xr_image_hash) _xr_image_hash = eina_hash_string_superfast_new(NULL);
+   _xr_image_hash = eina_hash_direct_add(_xr_image_hash, im->fkey, im);
    return im;
 }
 
@@ -217,7 +220,7 @@ _xre_image_free(XR_Image *im)
    if (!im->dirty)
      {
        if (im->fkey)
-         _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+         eina_hash_del(_xr_image_hash, im->fkey, im);
        _xr_image_cache = eina_list_prepend(_xr_image_cache, im);
        _xr_image_cache_usage += (im->w * im->h * 4);
        _xre_image_cache_set(_xr_image_cache_size);
@@ -245,7 +248,7 @@ _xre_image_dirty(XR_Image *im)
 {
    if (im->dirty) return;
    if (im->fkey)
-     _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+     eina_hash_del(_xr_image_hash, im->fkey, im);
    im->dirty = 1;
    __xre_image_dirty_hash_add(im);
 }
@@ -441,7 +444,7 @@ _xre_image_data_put(XR_Image *im, void *data)
    if (!im->dirty)
      {
        if (im->fkey)
-         _xr_image_hash = evas_hash_del(_xr_image_hash, im->fkey, im);
+         eina_hash_del(_xr_image_hash, im->fkey, im);
        im->dirty = 1;
      }
    if (im->updates)