/* Initialize the cache */ void init_cache() { dw_str *filename = 0; char *fname_convert = 0; struct stat cache_st; dwh_process_mararc_params(); /* Get the cache size */ if(cache != 0) { /* Don't init cache twice */ return; } /* See if we can read the cache from a file */ filename = key_s[DWM_S_cache_file]; if(filename != 0 && do_read_cache == 1) { dw_filename_sanitize(filename); fname_convert = (char *)dw_to_cstr(filename); if(stat(fname_convert,&cache_st) == 0 && cache_st.st_mtime < mararc_st.st_mtime) { dw_log_string( "Cache older than rc file; not reading cache",0); } else { cache = dwh_read_hash(fname_convert); } free(fname_convert); } if(cache == 0) { /* Just in case read from file failed */ cache = dwh_hash_init(0); /* Size comes from dwood2rc */ } }
/* Initialize the cache */ void init_cache() { dw_str *filename = 0; char *fname_convert = 0; dwh_process_mararc_params(); /* Get the cache size */ if(cache != 0) { /* Don't init cache twice */ return; } /* See if we can read the cache from a file */ filename = key_s[DWM_S_cache_file]; if(filename != 0) { dw_filename_sanitize(filename); fname_convert = (char *)dw_to_cstr(filename); cache = dwh_read_hash(fname_convert); free(fname_convert); } if(cache == 0) { /* Just in case read from file failed */ cache = dwh_hash_init(0); /* Size comes from dwood2rc */ } }