mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 03:44:46 +01:00
Changes an assert back into a conditional to match the behavior of `getPosix`, see https://codeberg.org/ziglang/zig/pulls/31113#issuecomment-10371698 and https://github.com/ziglang/zig/issues/23331. Note: the conditional has been updated to also return null early on 0-length key lookups, since there's no need to iterate the block in that case. For `Environ.Map`, validation of keys has been split into two categories: 'put' and 'fetch', each of which are tailored to the constraints that the implementation actually relies upon. Specifically: - Hashing (fetching) requires the keys to be valid WTF-8 on Windows, but does not rely on any other properties of the keys (attempting to fetch `F\x00=` is not a problem, it just won't be found) - `create{Posix,Windows}Block` relies on the Map to always have fully valid keys (no NUL, no `=` in an invalid location, no zero-length keys), which means that the 'put' APIs need to validate that incoming keys adhere to those properties. The relevant assertions are now documented on each of the Map functions. Also reinstates some test cases in the `env_vars` standalone test. Some of the reinstated tests are effectively just testing the Environ.Map implementation due to how `Environ.contains`, `Environ.getAlloc`, etc are implemented, but that is not inherent to those functions so the tests are still potentially relevant if e.g. `contains` is implemented in terms of `getPosix`/`getWindows` in the future (which is totally possible and maybe a good idea since constructing the whole map is not necessary for looking up one key). |
||
|---|---|---|
| .. | ||
| behavior | ||
| c_abi | ||
| cases | ||
| cli/options | ||
| incremental | ||
| link | ||
| src | ||
| standalone | ||
| behavior.zig | ||
| cases.zig | ||
| compile_errors.zig | ||
| error_traces.zig | ||
| gen_h.zig | ||
| libc.zig | ||
| llvm_ir.zig | ||
| llvm_targets.zig | ||
| stack_traces.zig | ||
| tests.zig | ||