Fix eina hash usage.

When using eina hash we need to create the hash if it does not exist.

SVN revision: 38172
This commit is contained in:
Sebastian Dransfeld 2008-12-17 08:04:42 +00:00
parent c80a55ee14
commit 28bf361096
2 changed files with 6 additions and 1 deletions

View File

@ -153,6 +153,7 @@ _oid_track(Edje *ed, Evas_Object *o)
evas_object_clip_set(oi->obj, oi->ed->clipper);
evas_object_geometry_get(oi->obj, &(oi->x), &(oi->y), &(oi->w), &(oi->h));
snprintf(buf, sizeof(buf), "%i", oi->oid);
if (!si->oid.hash) si->oid.hash = eina_hash_string_superfast_new(NULL);
eina_hash_add(si->oid.hash, buf, oi);
return oi;
}

View File

@ -298,6 +298,7 @@ edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2
free(cc);
return;
}
if (!_edje_color_class_hash) _edje_color_class_hash = eina_hash_string_superfast_new(NULL);
eina_hash_add(_edje_color_class_hash, color_class, cc);
}
@ -573,6 +574,7 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz
free(tc);
return;
}
if (!_edje_text_class_hash) _edje_text_class_hash = eina_hash_string_superfast_new(NULL);
eina_hash_add(_edje_text_class_hash, text_class, tc);
tc->font = eina_stringshare_add(font);
@ -2514,6 +2516,7 @@ _edje_color_class_member_add(Edje *ed, const char *color_class)
}
members = eina_list_prepend(members, ed);
if (!_edje_color_class_member_hash) _edje_color_class_member_hash = eina_hash_string_superfast_new(NULL);
eina_hash_add(_edje_color_class_member_hash, color_class, members);
}
@ -2530,7 +2533,7 @@ _edje_color_class_member_del(Edje *ed, const char *color_class)
members = eina_list_remove(members, ed);
if (members)
{
eina_hash_add(_edje_color_class_member_hash, color_class, members);
eina_hash_add(_edje_color_class_member_hash, color_class, members);
}
}
@ -2620,6 +2623,7 @@ _edje_text_class_member_add(Edje *ed, const char *text_class)
members = eina_list_prepend(members, ed);
/* Add the member list back */
if (!_edje_text_class_member_hash) _edje_text_class_member_hash = eina_hash_string_superfast_new(NULL);
eina_hash_add(_edje_text_class_member_hash, text_class, members);
}