diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-06-08 12:54:52 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-06-08 12:54:52 +0100 |
| commit | 2a89d8021cf95f4a4d7dab269a262a1d2237f71b (patch) | |
| tree | e955f29749310c1be63b43a231d217e584d996f1 /src/build_settings.cpp | |
| parent | 13deb4706c37acbababc6f60a1b6ec58c630a3f5 (diff) | |
Use templated `Array` with bounds checking
Diffstat (limited to 'src/build_settings.cpp')
| -rw-r--r-- | src/build_settings.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 1229c466c..dac763010 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -35,7 +35,7 @@ String const NIX_SEPARATOR_STRING = {cast(u8 *)"/", 1}; #if defined(GB_SYSTEM_WINDOWS) String odin_root_dir(void) { String path = global_module_path; - Array(wchar_t) path_buf; + Array<wchar_t> path_buf; isize len, i; gbTempArenaMemory tmp; wchar_t *text; @@ -48,7 +48,7 @@ String odin_root_dir(void) { len = 0; for (;;) { - len = GetModuleFileNameW(NULL, &path_buf.e[0], path_buf.count); + len = GetModuleFileNameW(NULL, &path_buf[0], path_buf.count); if (len == 0) { return make_string(NULL, 0); } @@ -102,7 +102,7 @@ String odin_root_dir(void) { len = 0; for (;;) { int sz = path_buf.count; - int res = _NSGetExecutablePath(&path_buf.e[0], &sz); + int res = _NSGetExecutablePath(&path_buf[0], &sz); if(res == 0) { len = sz; break; @@ -114,7 +114,7 @@ String odin_root_dir(void) { tmp = gb_temp_arena_memory_begin(&string_buffer_arena); text = gb_alloc_array(string_buffer_allocator, u8, len + 1); - gb_memmove(text, &path_buf.e[0], len); + gb_memmove(text, &path_buf[0], len); path = make_string(text, len); for (i = path.len-1; i >= 0; i--) { @@ -158,7 +158,7 @@ String odin_root_dir(void) { // of this compiler, it should be _good enough_. // That said, there's no solid 100% method on Linux to get the program's // path without checking this link. Sorry. - len = readlink("/proc/self/exe", &path_buf.e[0], path_buf.count); + len = readlink("/proc/self/exe", &path_buf[0], path_buf.count); if(len == 0) { return make_string(NULL, 0); } @@ -171,7 +171,7 @@ String odin_root_dir(void) { tmp = gb_temp_arena_memory_begin(&string_buffer_arena); text = gb_alloc_array(string_buffer_allocator, u8, len + 1); - gb_memmove(text, &path_buf.e[0], len); + gb_memmove(text, &path_buf[0], len); path = make_string(text, len); for (i = path.len-1; i >= 0; i--) { |