BlockArena, a bit of allocator rework
This commit is contained in:
@@ -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 {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user