authorgravatar for 6576327+yyny@users.noreply.github.comyyny <6576327+yyny@users.noreply.github.com> 2022-08-24 02:44:42+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-08-23 19:44:42-05:00
log0f01e812ff054ea83661272bf0a96af228f2ffe3
treef31fd5fb6271813e5688ef88261d2a2ddf90d2bb
parentd852894dcf6143ff76575245f092d9e26b0e8fa6
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

std.os: add INVALID_SOCKET (#12081)

This constant returns an invalid `socket_t` that can be used as a sentinel value.

1 files changed, 1 insertions(+), 0 deletions(-)

lib/std/os.zig+1
...@@ -235,6 +235,7 @@ pub const RelativePathWasi = struct {...@@ -235,6 +235,7 @@ pub const RelativePathWasi = struct {
235};235};
236236
237pub const socket_t = if (builtin.os.tag == .windows) windows.ws2_32.SOCKET else fd_t;237pub const socket_t = if (builtin.os.tag == .windows) windows.ws2_32.SOCKET else fd_t;
238pub const INVALID_SOCKET = if (builtin.os.tag == .windows) windows.ws2_32.INVALID_SOCKET else @as(socket_t, -1);
238239
239/// See also `getenv`. Populated by startup code before main().240/// See also `getenv`. Populated by startup code before main().
240/// TODO this is a footgun because the value will be undefined when using `zig build-lib`.241/// TODO this is a footgun because the value will be undefined when using `zig build-lib`.