Enlightenment CVS committal Author : englebass Project : e17 Module : libs/efreet
Dir : e17/libs/efreet/src/lib Modified Files: efreet_utils.c efreet_utils.h Log Message: Memory management =================================================================== RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_utils.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- efreet_utils.c 25 Mar 2007 12:57:49 -0000 1.8 +++ efreet_utils.c 25 Mar 2007 13:10:09 -0000 1.9 @@ -36,7 +36,10 @@ desktop_by_file_id = ecore_hash_new(ecore_str_hash, ecore_str_compare); ecore_hash_set_free_key(desktop_by_file_id, ECORE_FREE_CB(ecore_string_release)); desktop_by_exec = ecore_hash_new(ecore_str_hash, ecore_str_compare); + ecore_hash_set_free_key(desktop_by_exec, ECORE_FREE_CB(ecore_string_release)); file_id_by_desktop_path = ecore_hash_new(ecore_str_hash, ecore_str_compare); + ecore_hash_set_free_key(file_id_by_desktop_path, ECORE_FREE_CB(ecore_string_release)); + ecore_hash_set_free_value(file_id_by_desktop_path, ECORE_FREE_CB(ecore_string_release)); fill = NEW(Efreet_Cache_Fill, 1); fill->dirs = ecore_list_new(); @@ -105,12 +108,13 @@ return ret; } -char * +const char * efreet_util_path_to_file_id(const char *path) { size_t len; - char *file_id, *p; + char *tmp, *p; char *base; + const char *file_id = NULL; if (!path) return NULL; file_id = ecore_hash_get(file_id_by_desktop_path, path); @@ -131,16 +135,18 @@ return NULL; } - file_id = strdup(path + len + 1); - p = file_id; + tmp = strdup(path + len + 1); + p = tmp; while (*p) { if (*p == '/') *p = '-'; p++; } free(base); - if (file_id) ecore_hash_set(file_id_by_desktop_path, (void *)ecore_string_instance(path), - (void *)ecore_string_instance(file_id)); + file_id = ecore_string_instance(tmp); + free(tmp); + ecore_hash_set(file_id_by_desktop_path, (void *)ecore_string_instance(path), + (void *)file_id); return file_id; } =================================================================== RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_utils.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- efreet_utils.h 25 Mar 2007 12:57:49 -0000 1.6 +++ efreet_utils.h 25 Mar 2007 13:10:09 -0000 1.7 @@ -3,7 +3,7 @@ #define EFREET_UTILS_H char *efreet_util_path_in_default(const char *section, const char *path); -char *efreet_util_path_to_file_id(const char *path); +const char *efreet_util_path_to_file_id(const char *path); Efreet_Desktop *efreet_util_desktop_file_id_find(const char *file_id); Efreet_Desktop *efreet_util_desktop_exec_find(const char *exec); ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs