diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2021-08-26 16:06:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-26 16:06:37 +0100 |
| commit | 6dfab34aca9a645f6f8c1ddd220f663aa90de529 (patch) | |
| tree | 0436f1ac647625bfc1067c6419e831599a8ef811 /src/build_settings.cpp | |
| parent | 98dd59e412314f089fc9558c5cf92a8a5df5213a (diff) | |
| parent | d3d805ffb3e859c1fa85865345c5adc557326c2d (diff) | |
Merge pull request #1101 from odin-lang/compiler-allocator-improvements
Compiler Allocator Improvements
Diffstat (limited to 'src/build_settings.cpp')
| -rw-r--r-- | src/build_settings.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp index f58ac84a2..f3cc45ae8 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -500,7 +500,6 @@ String odin_root_dir(void) { String internal_odin_root_dir(void) { String path = global_module_path; isize len, i; - gbTempArenaMemory tmp; wchar_t *text; if (global_module_path_set) { @@ -525,10 +524,7 @@ String internal_odin_root_dir(void) { mutex_lock(&string_buffer_mutex); defer (mutex_unlock(&string_buffer_mutex)); - tmp = gb_temp_arena_memory_begin(&string_buffer_arena); - defer (gb_temp_arena_memory_end(tmp)); - - text = gb_alloc_array(string_buffer_allocator, wchar_t, len+1); + text = gb_alloc_array(permanent_allocator(), wchar_t, len+1); GetModuleFileNameW(nullptr, text, cast(int)len); path = string16_to_string(heap_allocator(), make_string16(text, len)); @@ -559,7 +555,6 @@ String path_to_fullpath(gbAllocator a, String s); String internal_odin_root_dir(void) { String path = global_module_path; isize len, i; - gbTempArenaMemory tmp; u8 *text; if (global_module_path_set) { @@ -583,10 +578,7 @@ String internal_odin_root_dir(void) { mutex_lock(&string_buffer_mutex); defer (mutex_unlock(&string_buffer_mutex)); - tmp = gb_temp_arena_memory_begin(&string_buffer_arena); - defer (gb_temp_arena_memory_end(tmp)); - - text = gb_alloc_array(string_buffer_allocator, u8, len + 1); + text = gb_alloc_array(permanent_allocator(), u8, len + 1); gb_memmove(text, &path_buf[0], len); path = path_to_fullpath(heap_allocator(), make_string(text, len)); @@ -617,7 +609,6 @@ String path_to_fullpath(gbAllocator a, String s); String internal_odin_root_dir(void) { String path = global_module_path; isize len, i; - gbTempArenaMemory tmp; u8 *text; if (global_module_path_set) { @@ -660,10 +651,7 @@ String internal_odin_root_dir(void) { mutex_lock(&string_buffer_mutex); defer (mutex_unlock(&string_buffer_mutex)); - tmp = gb_temp_arena_memory_begin(&string_buffer_arena); - defer (gb_temp_arena_memory_end(tmp)); - - text = gb_alloc_array(string_buffer_allocator, u8, len + 1); + text = gb_alloc_array(permanent_allocator(), u8, len + 1); gb_memmove(text, &path_buf[0], len); @@ -691,13 +679,11 @@ String path_to_fullpath(gbAllocator a, String s) { mutex_lock(&fullpath_mutex); defer (mutex_unlock(&fullpath_mutex)); - gbTempArenaMemory tmp = gb_temp_arena_memory_begin(&string_buffer_arena); - defer (gb_temp_arena_memory_end(tmp)); - String16 string16 = string_to_string16(string_buffer_allocator, s); + String16 string16 = string_to_string16(temporary_allocator(), s); DWORD len = GetFullPathNameW(&string16[0], 0, nullptr, nullptr); if (len != 0) { - wchar_t *text = gb_alloc_array(string_buffer_allocator, wchar_t, len+1); + wchar_t *text = gb_alloc_array(permanent_allocator(), wchar_t, len+1); GetFullPathNameW(&string16[0], len, text, nullptr); text[len] = 0; result = string16_to_string(a, make_string16(text, len)); |