From 4eeab3fe72b593eedffb81b442fb2562826d567b Mon Sep 17 00:00:00 2001 From: stffrdhrn Date: Sat, 3 Dec 2005 12:25:06 +0000 Subject: [PATCH] Trying to hunt white efm bug - Cleanup: Ecore_List -> Evas_List - Fix: a leak where heap was twice allocated SVN revision: 18812 --- src/bin/e_fileman_smart.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bin/e_fileman_smart.c b/src/bin/e_fileman_smart.c index ed07693..74bdf8c 100644 --- a/src/bin/e_fileman_smart.c +++ b/src/bin/e_fileman_smart.c @@ -835,7 +835,7 @@ _e_fm_smart_show(Evas_Object *object) if ((!object) || !(sd = evas_object_smart_data_get(object))) return; - + evas_object_show(sd->edje_obj); evas_object_show(sd->clip_obj); } @@ -1453,7 +1453,7 @@ static void _e_fm_dir_set(E_Fm_Smart_Data *sd, const char *dir) { Evas_List *l; - Ecore_List *list; + Evas_List *list; Ecore_Sheap *heap; char *f; int type; @@ -1468,28 +1468,28 @@ _e_fm_dir_set(E_Fm_Smart_Data *sd, const char *dir) if (!(dir2 = opendir(dir))) return; type = E_FM_FILE_TYPE_NORMAL; - list = ecore_list_new(); - ecore_list_set_free_cb(list, free); - /* TODO: use sorting function here */ - heap = ecore_sheap_new(ECORE_COMPARE_CB(strcasecmp), ecore_list_nodes(list)); + list = NULL; while(dp = readdir(dir2)) { if ((!strcmp(dp->d_name, ".") || (!strcmp (dp->d_name, "..")))) continue; if ((dp->d_name[0] == '.') && (!(type & E_FM_FILE_TYPE_HIDDEN))) continue; f = strdup(dp->d_name); - ecore_list_append(list, f); + list = evas_list_append(list, f); } closedir(dir2); - heap = ecore_sheap_new(ECORE_COMPARE_CB(strcasecmp), ecore_list_nodes(list)); - while ((f = ecore_list_remove_first(list))) - ecore_sheap_insert(heap, f); + heap = ecore_sheap_new(ECORE_COMPARE_CB(strcasecmp), evas_list_count(list)); + while (list) + { + f = list->data; + ecore_sheap_insert(heap, f); + list = evas_list_remove_list(list, list); + } - while ((f = ecore_sheap_extract(heap))) + while ((f = ecore_sheap_extract(heap))) sd->files_raw = evas_list_append(sd->files_raw, f); ecore_sheap_destroy(heap); - if (sd->dir) free (sd->dir); sd->dir = strdup(dir); -- 2.7.4