mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 09:24:33 +00:00
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