Remove the ISOFileSystem freelist, not threadsafe.

This commit is contained in:
Unknown W. Brackets
2013-04-13 13:04:39 -07:00
parent 914208309f
commit 053b33f5e2
2 changed files with 5 additions and 30 deletions
+3 -24
View File
@@ -131,8 +131,6 @@ struct VolDescriptor
#pragma pack(pop)
std::list<ISOFileSystem::TreeEntry *> ISOFileSystem::entryFreeList;
ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, BlockDevice *_blockDevice, std::string _restrictPath)
{
if (!_restrictPath.empty())
@@ -172,7 +170,7 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, BlockDevice *_blockDevic
ERROR_LOG(FILESYS, "ISO looks bogus? trying anyway...");
}
treeroot = GetTreeEntry();
treeroot = new TreeEntry();
treeroot->isDirectory = true;
treeroot->startingPosition = 0;
treeroot->size = 0;
@@ -189,7 +187,7 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, BlockDevice *_blockDevic
ISOFileSystem::~ISOFileSystem()
{
delete blockDevice;
ReleaseTreeEntry(treeroot);
delete treeroot;
}
void ISOFileSystem::ReadDirectory(u32 startsector, u32 dirsize, TreeEntry *root, size_t level)
@@ -220,7 +218,7 @@ void ISOFileSystem::ReadDirectory(u32 startsector, u32 dirsize, TreeEntry *root,
bool isFile = (dir.flags & 2) ? false : true;
bool relative;
TreeEntry *e = GetTreeEntry();
TreeEntry *e = new TreeEntry();
if (dir.identifierLength == 1 && (dir.firstIdChar == '\x00' || dir.firstIdChar == '.'))
{
e->name = ".";
@@ -614,25 +612,6 @@ std::string ISOFileSystem::EntryFullPath(TreeEntry *e)
return path;
}
ISOFileSystem::TreeEntry *ISOFileSystem::GetTreeEntry()
{
if (entryFreeList.empty())
return new TreeEntry();
else
{
TreeEntry *entry = entryFreeList.back();
entryFreeList.pop_back();
return entry;
}
}
void ISOFileSystem::ReleaseTreeEntry(ISOFileSystem::TreeEntry *entry)
{
entry->name.clear();
entry->children.clear();
entryFreeList.push_back(entry);
}
void ISOFileSystem::DoState(PointerWrap &p)
{
int n = (int) entries.size();