diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-06-15 16:31:54 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-06-16 20:12:26 +0200 |
| commit | 1a2f83f1235039b6bad43d9e697cc4b2f0fb2b60 (patch) | |
| tree | 3f2acb923ea254a632170dfe30a75f2f31db5d2a /core/sys/windows | |
| parent | 1bd48df41febbcf0f903fdfc697f59527b03bbe9 (diff) | |
Add bring-your-own-buffer versions of `os.lookup_env` and `os.get_env`
And make `core:terminal` use it so that `core:log` can be imported with `-default-to-nil-allocator`,
in which the actual allocator is set up in `main()`.
Windows was tricky because of the utf-8 <> utf-16 conversion, so we use some temporary stack buffers for that purpose,
limiting the non-allocating version there to 512 utf-16 characters each for the key and environment value.
In general the value is (obviously) limited to the size of the supplied buffer, and a `.Buffer_Full` error is returned
if that buffer is insufficient. If the key is not found, the procedure returns `.Env_Var_Not_Found`.
TODO:
- Factor out buffer-backed utf8 + utf16 conversion to `core:sys/util` to more easily apply this pattern.
- Add similar `lookup_env` and `get_env` procedures to `core:os/os2`.
Fixes #5336
Diffstat (limited to 'core/sys/windows')
0 files changed, 0 insertions, 0 deletions