Database: find_entry_ram: Avoid dircache use if it's not ready

git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_9@30256 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Hohmuth 2011-08-04 23:22:15 +00:00
parent 3049a6bd04
commit 211c082d91

View file

@ -390,7 +390,7 @@ static long find_entry_ram(const char *filename,
int i;
/* Check if tagcache is loaded into ram. */
if (!tc_stat.ramcache)
if (!tc_stat.ramcache || !is_dircache_intact())
return -1;
if (dc == NULL)
@ -538,8 +538,7 @@ static int find_index(const char *filename)
long idx_id = -1;
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
if (tc_stat.ramcache && is_dircache_intact())
idx_id = find_entry_ram(filename, NULL);
idx_id = find_entry_ram(filename, NULL);
#endif
if (idx_id < 0)
@ -1804,10 +1803,7 @@ static void __attribute__ ((noinline)) add_tagcache(char *path,
/* Check if the file is already cached. */
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
if (tc_stat.ramcache && is_dircache_intact())
{
idx_id = find_entry_ram(path, dc);
}
idx_id = find_entry_ram(path, dc);
#endif
/* Be sure the entry doesn't exist. */