mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 11:35:45 +00:00
used existing empty place in vector when allocate a new one
This commit is contained in:
parent
bfbe67bc42
commit
55a2bfcc29
1 changed files with 8 additions and 1 deletions
|
@ -40,7 +40,14 @@ int HandleTable::createHandle() {
|
|||
file->isOpened = false;
|
||||
|
||||
int existingFilesNum = m_files.size();
|
||||
// TODO when i close a file m_files probably have a open pos , so we can fill this
|
||||
|
||||
for (int index = 0; index < existingFilesNum; index++) {
|
||||
if (m_files.at(index) == nullptr) {
|
||||
m_files[index] = file;
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
m_files.push_back(file);
|
||||
|
||||
return existingFilesNum - 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue