Loading...
--- dyld/dyld-1335/common/FileManager.cpp
+++ dyld/dyld-1122.1.2/common/FileManager.cpp
@@ -47,9 +47,6 @@
FileManager::FileManager(Allocator& allocator, const SyscallDelegate* syscall)
: _syscall(syscall), _allocator(&allocator), _fsUUIDMap(_allocator->makeUnique<OrderedMap<uint64_t,UUID>>(*_allocator)) {}
-FileManager::FileManager(Allocator& allocator)
- : _syscall(nullptr), _allocator(&allocator), _fsUUIDMap(_allocator->makeUnique<OrderedMap<uint64_t,UUID>>(*_allocator)) {}
-
void FileManager::swap(FileManager& other) {
using std::swap;
@@ -57,10 +54,9 @@
std::swap(_fsUUIDMap, other._fsUUIDMap);
}
+
FileRecord FileManager::fileRecordForPath(Allocator& allocator, const char* filePath) {
- const char* str = nullptr;
- if ( filePath )
- str = allocator.strdup(filePath);
+ auto str = allocator.strdup(filePath);
return FileRecord(*this, UniquePtr<const char>(str));
}
@@ -97,7 +93,6 @@
} __attribute__((aligned(4), packed));
typedef struct VolAttrBuf VolAttrBuf;
- STACK_ALLOCATOR(ephemeralAllocator, 0);
while (1) {
int fsCount = getfsstat(nullptr, 0, MNT_NOWAIT);
if (fsCount == -1) {
@@ -105,10 +100,10 @@
break;
}
int fsInfoSize = fsCount*sizeof(struct statfs);
- auto fsInfos = (struct statfs *)ephemeralAllocator.malloc(fsInfoSize);
+ auto fsInfos = (struct statfs *)_allocator->malloc(fsInfoSize);
if (this->getfsstat(fsInfos, fsInfoSize, MNT_NOWAIT) != fsCount) {
// Retry
- ephemeralAllocator.free((void*)fsInfos);
+ _allocator->free((void*)fsInfos);
continue;
}
for (auto i = 0; i < fsCount; ++i) {
@@ -141,7 +136,7 @@
_fsUUIDMap->insert({f_fsid, UUID()});
}
}
- ephemeralAllocator.free((void*)fsInfos);
+ _allocator->free((void*)fsInfos);
break;
}
}