aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-02-10 11:46:29 +0000
committergingerBill <bill@gingerbill.org>2023-02-10 11:46:29 +0000
commit55b79c078cb9fad7d8310d93cbc92a2ca3c4efd2 (patch)
treeffebc80822d3935b8e0b066a7eb5ceafa1a92244
parent570b1278694e4c7fae7229027ce8984a6a58491b (diff)
Remove `:= context.allocator` usage in `package os2`
-rw-r--r--core/os/os2/env.odin8
-rw-r--r--core/os/os2/env_linux.odin6
-rw-r--r--core/os/os2/file_linux.odin4
-rw-r--r--core/os/os2/file_util.odin3
-rw-r--r--core/os/os2/path_linux.odin2
-rw-r--r--core/os/os2/stat_linux.odin6
6 files changed, 17 insertions, 12 deletions
diff --git a/core/os/os2/env.odin b/core/os/os2/env.odin
index f25290a59..54c26981b 100644
--- a/core/os/os2/env.odin
+++ b/core/os/os2/env.odin
@@ -1,10 +1,12 @@
package os2
+import "core:runtime"
+
// get_env retrieves the value of the environment variable named by the key
// It returns the value, which will be empty if the variable is not present
// To distinguish between an empty value and an unset value, use lookup_env
// NOTE: the value will be allocated with the supplied allocator
-get_env :: proc(key: string, allocator := context.allocator) -> string {
+get_env :: proc(key: string, allocator: runtime.Allocator) -> string {
value, _ := lookup_env(key, allocator)
return value
}
@@ -13,7 +15,7 @@ get_env :: proc(key: string, allocator := context.allocator) -> string {
// If the variable is found in the environment the value (which can be empty) is returned and the boolean is true
// Otherwise the returned value will be empty and the boolean will be false
// NOTE: the value will be allocated with the supplied allocator
-lookup_env :: proc(key: string, allocator := context.allocator) -> (value: string, found: bool) {
+lookup_env :: proc(key: string, allocator: runtime.Allocator) -> (value: string, found: bool) {
return _lookup_env(key, allocator)
}
@@ -36,7 +38,7 @@ clear_env :: proc() {
// environ returns a copy of strings representing the environment, in the form "key=value"
// NOTE: the slice of strings and the strings with be allocated using the supplied allocator
-environ :: proc(allocator := context.allocator) -> []string {
+environ :: proc(allocator: runtime.Allocator) -> []string {
return _environ(allocator)
}
diff --git a/core/os/os2/env_linux.odin b/core/os/os2/env_linux.odin
index 1833ac4dc..9a2c52739 100644
--- a/core/os/os2/env_linux.odin
+++ b/core/os/os2/env_linux.odin
@@ -1,7 +1,9 @@
//+private
package os2
-_get_env :: proc(key: string, allocator := context.allocator) -> (value: string, found: bool) {
+import "core:runtime"
+
+_get_env :: proc(key: string, allocator: runtime.Allocator) -> (value: string, found: bool) {
//TODO
return
}
@@ -20,7 +22,7 @@ _clear_env :: proc() {
//TODO
}
-_environ :: proc(allocator := context.allocator) -> []string {
+_environ :: proc(allocator: runtime.Allocator) -> []string {
//TODO
return nil
}
diff --git a/core/os/os2/file_linux.odin b/core/os/os2/file_linux.odin
index 0f2e810f4..1257a3d7b 100644
--- a/core/os/os2/file_linux.odin
+++ b/core/os/os2/file_linux.odin
@@ -254,7 +254,7 @@ _symlink :: proc(old_name, new_name: string) -> Error {
return _ok_or_error(unix.sys_symlink(old_name_cstr, new_name_cstr))
}
-_read_link_cstr :: proc(name_cstr: cstring, allocator := context.allocator) -> (string, Error) {
+_read_link_cstr :: proc(name_cstr: cstring, allocator: runtime.Allocator) -> (string, Error) {
bufsz : uint = 256
buf := make([]byte, bufsz, allocator)
for {
@@ -272,7 +272,7 @@ _read_link_cstr :: proc(name_cstr: cstring, allocator := context.allocator) -> (
}
}
-_read_link :: proc(name: string, allocator := context.allocator) -> (string, Error) {
+_read_link :: proc(name: string, allocator: runtime.Allocator) -> (string, Error) {
name_cstr, allocated := _name_to_cstring(name)
defer if allocated {
delete(name_cstr)
diff --git a/core/os/os2/file_util.odin b/core/os/os2/file_util.odin
index 9f9064244..60c3efe44 100644
--- a/core/os/os2/file_util.odin
+++ b/core/os/os2/file_util.odin
@@ -1,6 +1,7 @@
package os2
import "core:mem"
+import "core:runtime"
import "core:strconv"
import "core:unicode/utf8"
@@ -74,7 +75,7 @@ read_ptr :: proc(f: ^File, data: rawptr, len: int) -> (n: int, err: Error) {
-read_entire_file :: proc(name: string, allocator := context.allocator) -> (data: []byte, err: Error) {
+read_entire_file :: proc(name: string, allocator: runtime.Allocator) -> (data: []byte, err: Error) {
f, ferr := open(name)
if ferr != nil {
return nil, ferr
diff --git a/core/os/os2/path_linux.odin b/core/os/os2/path_linux.odin
index 2f59d1f13..60161f496 100644
--- a/core/os/os2/path_linux.odin
+++ b/core/os/os2/path_linux.odin
@@ -229,7 +229,7 @@ _setwd :: proc(dir: string) -> Error {
return _ok_or_error(unix.sys_chdir(dir_cstr))
}
-_get_full_path :: proc(fd: int, allocator := context.allocator) -> string {
+_get_full_path :: proc(fd: int, allocator: runtime.Allocator) -> string {
PROC_FD_PATH :: "/proc/self/fd/"
buf: [32]u8
diff --git a/core/os/os2/stat_linux.odin b/core/os/os2/stat_linux.odin
index b627cef15..2f99f6d2e 100644
--- a/core/os/os2/stat_linux.odin
+++ b/core/os/os2/stat_linux.odin
@@ -83,7 +83,7 @@ _Stat :: struct {
}
-_fstat :: proc(f: ^File, allocator := context.allocator) -> (File_Info, Error) {
+_fstat :: proc(f: ^File, allocator: runtime.Allocator) -> (File_Info, Error) {
return _fstat_internal(f.impl.fd, allocator)
}
@@ -111,7 +111,7 @@ _fstat_internal :: proc(fd: int, allocator: runtime.Allocator) -> (File_Info, Er
}
// NOTE: _stat and _lstat are using _fstat to avoid a race condition when populating fullpath
-_stat :: proc(name: string, allocator := context.allocator) -> (File_Info, Error) {
+_stat :: proc(name: string, allocator: runtime.Allocator) -> (File_Info, Error) {
name_cstr, allocated := _name_to_cstring(name)
defer if allocated {
delete(name_cstr)
@@ -125,7 +125,7 @@ _stat :: proc(name: string, allocator := context.allocator) -> (File_Info, Error
return _fstat_internal(fd, allocator)
}
-_lstat :: proc(name: string, allocator := context.allocator) -> (File_Info, Error) {
+_lstat :: proc(name: string, allocator: runtime.Allocator) -> (File_Info, Error) {
name_cstr, allocated := _name_to_cstring(name)
defer if allocated {
delete(name_cstr)