zig/lib/std/os
Ryan Liptak 6aa3570cb0 windows: Make readLinkW APIs output WTF-16, reduce stack usage of callers
- Affects the following functions:
  + `std.fs.Dir.readLinkW`
  + `std.os.windows.ReadLink`
  + `std.os.windows.ntToWin32Namespace`
  + `std.posix.readlinkW`
  + `std.posix.readlinkatW`

Each of these functions (except `ntToWin32Namespace`) took WTF-16 as input and would output WTF-8, which makes optimal buffer re-use difficult at callsites and could force unnecessary WTF-16 <-> WTF-8 conversion during an intermediate step.

The functions have been updated to output WTF-16, and also allow for the path and the output to re-use the same buffer (i.e. in-place modification), which can reduce the stack usage at callsites. For example, all of `std.fs.Dir.readLink`/`readLinkZ`/`std.posix.readlink`/`readlinkZ`/`readlinkat`/`readlinkatZ` have had their stack usage reduced by one PathSpace struct (64 KiB) when targeting Windows.

The new `ntToWin32Namespace` takes an output buffer and returns a slice from that instead of returning a PathSpace, which is necessary to make the above possible.
2025-11-15 18:16:03 -08:00
..
linux Merge pull request #25763 from mrjbq7/cancelled 2025-10-30 04:40:13 +00:00
plan9 zig fmt 2025-07-16 10:27:39 -07:00
uefi std.Io: delete GenericReader 2025-08-29 17:14:26 -07:00
windows std.os.windows: eliminate forwarder function in kernel32 (#25766) 2025-10-31 13:54:50 +00:00
emscripten.zig std: make signal numbers into an enum 2025-10-29 06:20:51 -07:00
freebsd.zig std: stop exposing anything having to do with ucontext_t 2025-10-10 04:43:18 +02:00
linux.zig posix: reduce the number of assumptions made by dl_iterate_phdr 2025-11-09 03:31:26 -05:00
plan9.zig sigset_t: sigemptyset() and sigfillset() are functions that return sigset_t 2025-04-30 20:32:04 -07:00
uefi.zig std.Io: delete GenericReader 2025-08-29 17:14:26 -07:00
wasi.zig wasi: fix wasm-wasi-musl constants 2025-02-09 09:08:11 +01:00
windows.zig windows: Make readLinkW APIs output WTF-16, reduce stack usage of callers 2025-11-15 18:16:03 -08:00