Enlightenment CVS committal Author : englebass Project : e17 Module : libs/efreet
Dir : e17/libs/efreet/src/lib Modified Files: efreet_menu.c efreet_utils.c efreet_utils.h Log Message: Simplify function. =================================================================== RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_menu.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- efreet_menu.c 24 Mar 2007 19:01:29 -0000 1.6 +++ efreet_menu.c 25 Mar 2007 10:49:04 -0000 1.7 @@ -803,13 +803,10 @@ efreet_menu_desktop_insert(Efreet_Menu *menu, Efreet_Desktop *desktop, int pos) { Efreet_Menu *entry; - char *path; char *id; if (!desktop || !menu) return 0; - path = efreet_util_path_in_default("applications", desktop->orig_path); - if (!path) return 0; - id = efreet_util_path_to_file_id(path, desktop->orig_path); + id = efreet_util_path_to_file_id(desktop->orig_path); entry = efreet_menu_entry_new(); entry->type = EFREET_MENU_ENTRY_DESKTOP; @@ -833,7 +830,6 @@ } free(id); - free(path); return 1; } =================================================================== RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_utils.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- efreet_utils.c 25 Mar 2007 10:42:28 -0000 1.5 +++ efreet_utils.c 25 Mar 2007 10:49:04 -0000 1.6 @@ -41,14 +41,27 @@ } char * -efreet_util_path_to_file_id(const char *base, const char *path) +efreet_util_path_to_file_id(const char *path) { size_t len; char *id, *p; + char *base; + + if (!path) return NULL; + base = efreet_util_path_in_default("applications", path); + if (!base) return NULL; len = strlen(base); - if (strlen(path) <= len) return NULL; - if (strncmp(path, base, len)) return NULL; + if (strlen(path) <= len) + { + free(base); + return NULL; + } + if (strncmp(path, base, len)) + { + free(base); + return NULL; + } id = strdup(path + len + 1); p = id; @@ -57,6 +70,7 @@ if (*p == '/') *p = '-'; p++; } + free(base); return id; } =================================================================== RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_utils.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- efreet_utils.h 24 Mar 2007 21:59:34 -0000 1.3 +++ efreet_utils.h 25 Mar 2007 10:49:04 -0000 1.4 @@ -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 *base, const char *path); +char *efreet_util_path_to_file_id(const char *path); Efreet_Desktop *efreet_util_desktop_by_file_id_get(const char *file_id); #endif ------------------------------------------------------------------------- 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