diff --git a/ChangeLog b/ChangeLog index 32cb0c564..043836abc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ -2013-02-02 Chidambar Zinnoury (ilLogict) +2013-02-04 Mike Blumenkrantz - * Music-control settings: add check changed. + * optimize use of edje_file_collection_list 2013-02-01 Mike Blumenkrantz diff --git a/NEWS b/NEWS index c18b14d66..ab15673a8 100644 --- a/NEWS +++ b/NEWS @@ -54,7 +54,6 @@ Improvements: - desktop environments, - language, - notification, - - music-control. * Improve UI of desk settings. * Add icons for gadcon settings. * Improve strings of pager settings. @@ -82,6 +81,7 @@ Improvements: * split out binding configs into separate config domain * binding dialogs are now able to reset bindings to the system profile file bindings * "No listable items" in Navigate menu is now clickable + * optimize use of edje_file_collection_list Fixes: * IBar menu didn't allow to configure different icon sources, show contents menu even on empty IBar. diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c index fb758252b..f47ac5817 100644 --- a/src/bin/e_bg.c +++ b/src/bin/e_bg.c @@ -78,7 +78,7 @@ e_bg_shutdown(void) EAPI const E_Config_Desktop_Background * e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y) { - Eina_List *l, *ll, *entries; + Eina_List *l, *entries; E_Config_Desktop_Background *bg = NULL, *cfbg = NULL; const char *bgfile = ""; char *entry; @@ -121,18 +121,17 @@ e_bg_config_get(int container_num, int zone_num, int desk_x, int desk_y) if (eina_str_has_extension(bgfile, ".edj")) { entries = edje_file_collection_list(bgfile); - if (entries) + EINA_LIST_FREE(entries, entry) { - EINA_LIST_FOREACH(entries, ll, entry) + if (!strcmp(entry, "e/desktop/background")) { - if (!strcmp(entry, "e/desktop/background")) - { - bg = cfbg; - current_spec = spec; - } + bg = cfbg; + current_spec = spec; + break; } - edje_file_collection_list_free(entries); + eina_stringshare_del(entry); } + E_FREE_LIST(entries, eina_stringshare_del); } else { diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 64626435b..a84d16101 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -1979,9 +1979,10 @@ _e_fm2_icon_thumb_edje_get(Evas *evas, const E_Fm2_Icon *ic, Evas_Smart_Cb cb, v group = eina_stringshare_add(*itr); else { - Eina_List *l = edje_file_collection_list(buf); - if (!l) return NULL; - group = eina_stringshare_add(eina_list_data_get(l)); + Eina_List *l; + + l = edje_file_collection_list(buf); + group = eina_stringshare_ref(eina_list_data_get(l)); edje_file_collection_list_free(l); } if (!group) return NULL; diff --git a/src/bin/e_theme.c b/src/bin/e_theme.c index a9fc886a6..2f8c4e624 100644 --- a/src/bin/e_theme.c +++ b/src/bin/e_theme.c @@ -164,7 +164,6 @@ _e_theme_edje_file_get(const char *category, const char *group, Eina_Bool fallba { E_Theme_Result *res; char buf[4096]; - const char *q; char *p; /* find category -> edje mapping */ @@ -196,7 +195,7 @@ _e_theme_edje_file_get(const char *category, const char *group, Eina_Bool fallba if (str) { void *tres; - Eina_List *coll, *l; + Eina_List *coll; int ok; snprintf(buf, sizeof(buf), "%s/::/%s", str, group); @@ -206,18 +205,14 @@ _e_theme_edje_file_get(const char *category, const char *group, Eina_Bool fallba /* if the group exists - return */ if (!res->quickfind) { - const char *col; + Eina_Stringshare *col; res->quickfind = eina_hash_string_superfast_new(NULL); /* create a quick find hash of all group entries */ coll = edje_file_collection_list(str); - EINA_LIST_FOREACH(coll, l, col) - { - q = eina_stringshare_add(col); - eina_hash_direct_add(res->quickfind, q, q); - } - if (coll) edje_file_collection_list_free(coll); + EINA_LIST_FREE(coll, col) + eina_hash_direct_add(res->quickfind, col, col); } /* save in the group cache hash */ if (eina_hash_find(res->quickfind, group)) @@ -660,33 +655,28 @@ _e_theme_collection_items_find(const char *base, const char *collname) } if (str) { - Eina_List *coll, *l; + Eina_List *coll; + Eina_Stringshare *c; + int collname_len; coll = edje_file_collection_list(str); - if (coll) + if (coll) collname_len = strlen(collname); + EINA_LIST_FREE(coll, c) { - const char *c; - int collname_len; - - collname_len = strlen(collname); - EINA_LIST_FOREACH(coll, l, c) + if (!strncmp(c, collname, collname_len)) { - if (!strncmp(c, collname, collname_len)) - { - char *trans, *p2; + char *trans, *p2; - trans = strdup(c); - p = trans + collname_len + 1; - if (*p) - { - p2 = strchr(p, '/'); - if (p2) *p2 = 0; - list = _e_theme_collection_item_register(list, p); - } - free(trans); + trans = strdupa(c); + p = trans + collname_len + 1; + if (*p) + { + p2 = strchr(p, '/'); + if (p2) *p2 = 0; + list = _e_theme_collection_item_register(list, p); } } - edje_file_collection_list_free(coll); + eina_stringshare_del(c); } } } diff --git a/src/bin/e_utils.c b/src/bin/e_utils.c index 89409daa0..c642242ec 100644 --- a/src/bin/e_utils.c +++ b/src/bin/e_utils.c @@ -666,20 +666,18 @@ e_util_desk_border_below(E_Border *bd) EAPI int e_util_edje_collection_exists(const char *file, const char *coll) { - Eina_List *clist, *l; - char *str; + Eina_List *clist; + Eina_Stringshare *str; + Eina_Bool ret = EINA_FALSE; clist = edje_file_collection_list(file); - EINA_LIST_FOREACH(clist, l, str) + EINA_LIST_FREE(clist, str) { - if (!strcmp(coll, str)) - { - edje_file_collection_list_free(clist); - return 1; - } + if ((!ret) && (!strcmp(coll, str))) + ret = EINA_TRUE; + eina_stringshare_del(str); } - edje_file_collection_list_free(clist); - return 0; + return ret; } EAPI E_Dialog *