mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 23:28: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;
|
file->isOpened = false;
|
||||||
|
|
||||||
int existingFilesNum = m_files.size();
|
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);
|
m_files.push_back(file);
|
||||||
|
|
||||||
return existingFilesNum - 1;
|
return existingFilesNum - 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue