mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-08 16:48:18 +00:00
Merge branch 'master' of https://github.com/odin-lang/Odin
This commit is contained in:
@@ -22,9 +22,14 @@ global_default_temp_allocator_index: uint
|
|||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
temp_allocator :: proc() -> runtime.Allocator {
|
temp_allocator :: proc() -> runtime.Allocator {
|
||||||
|
arena := &global_default_temp_allocator_arenas[global_default_temp_allocator_index]
|
||||||
|
if arena.backing_allocator.procedure == nil {
|
||||||
|
arena.backing_allocator = heap_allocator()
|
||||||
|
}
|
||||||
|
|
||||||
return runtime.Allocator{
|
return runtime.Allocator{
|
||||||
procedure = temp_allocator_proc,
|
procedure = temp_allocator_proc,
|
||||||
data = &global_default_temp_allocator_arenas[global_default_temp_allocator_index],
|
data = arena,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1095,7 +1095,8 @@ unset_env :: proc(key: string) -> Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
get_current_directory :: proc() -> string {
|
get_current_directory :: proc(allocator := context.allocator) -> string {
|
||||||
|
context.allocator = allocator
|
||||||
page_size := get_page_size() // NOTE(tetra): See note in os_linux.odin/get_current_directory.
|
page_size := get_page_size() // NOTE(tetra): See note in os_linux.odin/get_current_directory.
|
||||||
buf := make([dynamic]u8, page_size)
|
buf := make([dynamic]u8, page_size)
|
||||||
for {
|
for {
|
||||||
|
|||||||
@@ -840,7 +840,8 @@ get_env :: proc(key: string, allocator := context.allocator) -> (value: string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
get_current_directory :: proc() -> string {
|
get_current_directory :: proc(allocator := context.allocator) -> string {
|
||||||
|
context.allocator = allocator
|
||||||
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
|
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
|
||||||
// an authoritative value for it across all systems.
|
// an authoritative value for it across all systems.
|
||||||
// The largest value I could find was 4096, so might as well use the page size.
|
// The largest value I could find was 4096, so might as well use the page size.
|
||||||
|
|||||||
@@ -985,7 +985,8 @@ unset_env :: proc(key: string) -> Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
get_current_directory :: proc() -> string {
|
get_current_directory :: proc(allocator := context.allocator) -> string {
|
||||||
|
context.allocator = allocator
|
||||||
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
|
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
|
||||||
// an authoritative value for it across all systems.
|
// an authoritative value for it across all systems.
|
||||||
// The largest value I could find was 4096, so might as well use the page size.
|
// The largest value I could find was 4096, so might as well use the page size.
|
||||||
|
|||||||
@@ -894,7 +894,8 @@ get_env :: proc(key: string, allocator := context.allocator) -> (value: string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
get_current_directory :: proc() -> string {
|
get_current_directory :: proc(allocator := context.allocator) -> string {
|
||||||
|
context.allocator = allocator
|
||||||
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
|
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
|
||||||
// an authoritative value for it across all systems.
|
// an authoritative value for it across all systems.
|
||||||
// The largest value I could find was 4096, so might as well use the page size.
|
// The largest value I could find was 4096, so might as well use the page size.
|
||||||
|
|||||||
@@ -806,7 +806,8 @@ get_env :: proc(key: string, allocator := context.allocator) -> (value: string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
get_current_directory :: proc() -> string {
|
get_current_directory :: proc(allocator := context.allocator) -> string {
|
||||||
|
context.allocator = allocator
|
||||||
buf := make([dynamic]u8, MAX_PATH)
|
buf := make([dynamic]u8, MAX_PATH)
|
||||||
for {
|
for {
|
||||||
cwd := _unix_getcwd(cstring(raw_data(buf)), c.size_t(len(buf)))
|
cwd := _unix_getcwd(cstring(raw_data(buf)), c.size_t(len(buf)))
|
||||||
|
|||||||
Reference in New Issue
Block a user