diff options
| author | gingerBill <bill@gingerbill.org> | 2023-06-28 11:57:43 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-06-28 11:57:43 +0100 |
| commit | 03e40b333ad7eeaefe3e5904849304a6da79fbb7 (patch) | |
| tree | 3d369ec46439c7e780bb0d82a6cef8f0dd1af5ba | |
| parent | ebed66d4ceee206998500b604a664e72a3ba9539 (diff) | |
| parent | 89e559296eda10fa596486c9d3c73dd909aa8c6d (diff) | |
Merge branch 'master' of https://github.com/odin-lang/Odin
| -rw-r--r-- | .github/workflows/nightly.yml | 3 | ||||
| -rw-r--r-- | core/os/os_linux.odin | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 67d0396c1..0bfaa11e9 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -7,6 +7,7 @@ on: jobs: build_windows: + if: github.repository == 'odin-lang/Odin' runs-on: windows-2022 steps: - uses: actions/checkout@v1 @@ -37,6 +38,7 @@ jobs: name: windows_artifacts path: dist build_ubuntu: + if: github.repository == 'odin-lang/Odin' runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 @@ -61,6 +63,7 @@ jobs: name: ubuntu_artifacts path: dist build_macos: + if: github.repository == 'odin-lang/Odin' runs-on: macOS-latest steps: - uses: actions/checkout@v1 diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin index e0b60fd36..1a4c1fddb 100644 --- a/core/os/os_linux.odin +++ b/core/os/os_linux.odin @@ -458,6 +458,7 @@ foreign libc { @(link_name="execvp") _unix_execvp :: proc(path: cstring, argv: [^]cstring) -> int --- @(link_name="getenv") _unix_getenv :: proc(cstring) -> cstring --- @(link_name="putenv") _unix_putenv :: proc(cstring) -> c.int --- + @(link_name="setenv") _unix_setenv :: proc(key: cstring, value: cstring, overwrite: c.int) -> c.int --- @(link_name="realpath") _unix_realpath :: proc(path: cstring, resolved_path: rawptr) -> rawptr --- @(link_name="exit") _unix_exit :: proc(status: c.int) -> ! --- @@ -893,8 +894,10 @@ get_env :: proc(key: string, allocator := context.allocator) -> (value: string) set_env :: proc(key, value: string) -> Errno { runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD() - s := strings.concatenate({key, "=", value, "\x00"}, context.temp_allocator) - res := _unix_putenv(strings.unsafe_string_to_cstring(s)) + key_cstring := strings.clone_to_cstring(key, context.temp_allocator) + value_cstring := strings.clone_to_cstring(value, context.temp_allocator) + // NOTE(GoNZooo): `setenv` instead of `putenv` because it copies both key and value more commonly + res := _unix_setenv(key_cstring, value_cstring, 1) if res < 0 { return Errno(get_last_error()) } |