Prevent destroying dircache pointers in tagcache DB while updating runtime stats.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13498 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2007-05-27 11:40:55 +00:00
parent 43c299eaa1
commit 4cee8d9354

View file

@ -547,9 +547,24 @@ static bool write_index(int masterfd, int idxid, struct index_entry *idx)
}
#ifdef HAVE_TC_RAMCACHE
/* Only update numeric data. Writing the whole index to RAM by memcpy
* destroys dircache pointers!
*/
if (tc_stat.ramcache)
{
memcpy(&hdr->indices[idxid], idx, sizeof(struct index_entry));
int tag;
struct index_entry *idx_ram = &hdr->indices[idxid];
for (tag = 0; tag < TAG_COUNT; tag++)
{
if (tagcache_is_numeric_tag(tag))
{
idx_ram->tag_seek[tag] = idx->tag_seek[tag];
}
}
/* Don't touch the dircache flag. */
idx_ram->flag = idx->flag | (idx_ram->flag & FLAG_DIRCACHE);
}
#endif