aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuriy Grynevych <greenyadzer@gmail.com>2024-09-18 21:03:48 +0300
committerYuriy Grynevych <greenyadzer@gmail.com>2024-09-18 21:03:48 +0300
commit4ff836609c1ec2aa598a129bf01499b7076aae78 (patch)
treef5b8ad654c5d648c03337e29335b466611f6c932
parent8814170edff5c7c70d17d5edf789bc478311d906 (diff)
[core/os] get_current_directory: Add allocator arg to targets where its missing
-rw-r--r--core/os/os_darwin.odin2
-rw-r--r--core/os/os_freebsd.odin2
-rw-r--r--core/os/os_linux.odin2
-rw-r--r--core/os/os_netbsd.odin2
-rw-r--r--core/os/os_openbsd.odin2
5 files changed, 5 insertions, 5 deletions
diff --git a/core/os/os_darwin.odin b/core/os/os_darwin.odin
index 2bb6c0c59..5cef568dd 100644
--- a/core/os/os_darwin.odin
+++ b/core/os/os_darwin.odin
@@ -1095,7 +1095,7 @@ unset_env :: proc(key: string) -> Error {
}
@(require_results)
-get_current_directory :: proc() -> string {
+get_current_directory :: proc(allocator := context.allocator) -> string {
page_size := get_page_size() // NOTE(tetra): See note in os_linux.odin/get_current_directory.
buf := make([dynamic]u8, page_size)
for {
diff --git a/core/os/os_freebsd.odin b/core/os/os_freebsd.odin
index 241f42c0b..9bf8ee50f 100644
--- a/core/os/os_freebsd.odin
+++ b/core/os/os_freebsd.odin
@@ -840,7 +840,7 @@ get_env :: proc(key: string, allocator := context.allocator) -> (value: string)
}
@(require_results)
-get_current_directory :: proc() -> string {
+get_current_directory :: proc(allocator := context.allocator) -> string {
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
// an authoritative value for it across all systems.
// The largest value I could find was 4096, so might as well use the page size.
diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin
index 9132edbfe..35799c3d9 100644
--- a/core/os/os_linux.odin
+++ b/core/os/os_linux.odin
@@ -985,7 +985,7 @@ unset_env :: proc(key: string) -> Error {
}
@(require_results)
-get_current_directory :: proc() -> string {
+get_current_directory :: proc(allocator := context.allocator) -> string {
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
// an authoritative value for it across all systems.
// The largest value I could find was 4096, so might as well use the page size.
diff --git a/core/os/os_netbsd.odin b/core/os/os_netbsd.odin
index ba9b40fc3..a311cc200 100644
--- a/core/os/os_netbsd.odin
+++ b/core/os/os_netbsd.odin
@@ -894,7 +894,7 @@ get_env :: proc(key: string, allocator := context.allocator) -> (value: string)
}
@(require_results)
-get_current_directory :: proc() -> string {
+get_current_directory :: proc(allocator := context.allocator) -> string {
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
// an authoritative value for it across all systems.
// The largest value I could find was 4096, so might as well use the page size.
diff --git a/core/os/os_openbsd.odin b/core/os/os_openbsd.odin
index aff78dc60..16d873588 100644
--- a/core/os/os_openbsd.odin
+++ b/core/os/os_openbsd.odin
@@ -806,7 +806,7 @@ get_env :: proc(key: string, allocator := context.allocator) -> (value: string)
}
@(require_results)
-get_current_directory :: proc() -> string {
+get_current_directory :: proc(allocator := context.allocator) -> string {
buf := make([dynamic]u8, MAX_PATH)
for {
cwd := _unix_getcwd(cstring(raw_data(buf)), c.size_t(len(buf)))