Enlightenment CVS committal Author : onefang Project : e17 Module : apps/e_utils
Dir : e17/apps/e_utils/src/bin/e17genmenu/src/bin Modified Files: fdo_paths.h main.c parse.c parse.h Log Message: FIXME-- We will be needing that ini file cache soon. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/fdo_paths.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- fdo_paths.h 10 Feb 2006 07:00:54 -0000 1.9 +++ fdo_paths.h 17 Feb 2006 06:57:19 -0000 1.10 @@ -24,10 +24,10 @@ { # endif - void fdo_paths_init(); + void fdo_paths_init(void); char *fdo_paths_search_for_file(Fdo_Paths_Type type, char *file, int sub, int (*func) (const void *data, char *path), const void *data); char *fdo_paths_recursive_search(char *path, char *d, int (*func) (const void *data, char *path), const void *data); - void fdo_paths_shutdown(); + void fdo_paths_shutdown(void); # ifdef __cplusplus } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/main.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- main.c 14 Feb 2006 08:40:44 -0000 1.18 +++ main.c 17 Feb 2006 06:57:19 -0000 1.19 @@ -36,6 +36,7 @@ printf("Testing FDO paths\n"); fdo_paths_init(); + parse_ini_init(); /* You can iterate through the various path lists as needed. */ for (i = 0; i < fdo_paths_menus->size; i++) @@ -120,6 +121,7 @@ free(path); } + parse_ini_shutdown(); fdo_paths_shutdown(); _e17genmenu_shutdown(); @@ -241,6 +243,7 @@ /* Get the fdo paths. */ fdo_paths_init(); + parse_ini_init(); /* Start Making Menus */ make_menus(); @@ -257,6 +260,7 @@ get_home()); system(path); + parse_ini_shutdown(); fdo_paths_shutdown(); /* Shutdown */ =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/parse.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- parse.c 14 Feb 2006 08:40:44 -0000 1.10 +++ parse.c 17 Feb 2006 06:57:19 -0000 1.11 @@ -373,12 +373,29 @@ free(eap); } +void +parse_ini_init() +{ + if (!ini_file_cache) + { + ini_file_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare); + if (ini_file_cache) + { + ecore_hash_set_free_key(ini_file_cache, free); + ecore_hash_set_free_value(ini_file_cache, (Ecore_Free_Cb) ecore_hash_destroy); + } + } +} + Ecore_Hash * parse_ini_file(char *file) { Ecore_Hash *result; - /* FIXME: this should probably be optimised by caching the results, then looking in the cache first. */ + result = (Ecore_Hash *) ecore_hash_get(ini_file_cache, file); + if (result) + return result; + result = ecore_hash_new(ecore_str_hash, ecore_str_compare); if (result) { @@ -467,6 +484,17 @@ buffer[0] = (char)0; fclose(f); + ecore_hash_set(ini_file_cache, strdup(file), result); } return result; } + +void +parse_ini_shutdown() +{ + if(ini_file_cache) + { + ecore_hash_destroy(ini_file_cache); + ini_file_cache = NULL; + } +} =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/parse.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- parse.h 3 Feb 2006 00:15:12 -0000 1.3 +++ parse.h 17 Feb 2006 06:57:19 -0000 1.4 @@ -6,6 +6,8 @@ #include <unistd.h> #include <Ecore_Data.h> +Ecore_Hash *ini_file_cache; + /* Function Prototypes */ char *get_t(char *icon); char *parse_exec(char *exec); @@ -13,6 +15,8 @@ void parse_desktop_file(char *path); void parse_debian_file(char *file); void process_file(char *file, G_Eap *eap); +void parse_ini_init(void); Ecore_Hash *parse_ini_file(char *file); +void parse_ini_shutdown(void); #endif ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs