BlockArena, a bit of allocator rework

This commit is contained in:
Krzosa Karol
2025-11-30 19:54:46 +01:00
parent c19c60fe22
commit c2f4686bc4
15 changed files with 337 additions and 224 deletions

View File

@@ -442,7 +442,7 @@ API String ReadFile(Allocator arena, String path) {
}
if (!success) {
Dealloc(arena, &result.data);
Dealloc(arena, result.data);
result = {};
}
@@ -566,7 +566,7 @@ API String GetExePath(Allocator allocator) {
}
API String GetExeDir(Allocator allocator) {
Scratch scratch((Arena *)allocator.object);
Scratch scratch(allocator);
String path = GetExePath(scratch);
path = ChopLastSlash(path);
path = Copy(allocator, path);
@@ -852,7 +852,7 @@ API String PollStdout(Allocator allocator, Process *process, bool force_read) {
bool read_error = ReadFile(p->child_stdout_read, buffer, (DWORD)buffer_size, &bytes_read, 0) == 0;
if (read_error) {
Win32ReportError("Failed to read the stdout of child process", "ReadFile");
Dealloc(allocator, &buffer);
Dealloc(allocator, buffer);
Win32CloseProcess(process);
return {};
}