refactor: use function-local statics for platform accessors to dodge SIOF

This commit is contained in:
MatthewBeshay
2026-04-08 20:22:40 +10:00
parent 60410f59bf
commit b032e2a3a0
10 changed files with 110 additions and 22 deletions

View File

@@ -6,8 +6,12 @@
#include <unistd.h>
#endif
StdFilesystem std_filesystem_instance;
IPlatformFilesystem& PlatformFilesystem = std_filesystem_instance;
namespace platform_internal {
IPlatformFilesystem& PlatformFilesystem_get() {
static StdFilesystem instance;
return instance;
}
}
IPlatformFilesystem::ReadResult StdFilesystem::readFile(const std::filesystem::path& path,
void* buffer, std::size_t capacity) {