uws: tidy use of ssl intFromBool (#12839)

This commit is contained in:
Meghan Denny
2024-07-26 03:58:01 -07:00
committed by GitHub
parent 92c83fcd9e
commit 080a2806af

View File

@@ -1086,7 +1086,7 @@ pub const Timer = opaque {
pub const SocketContext = opaque {
pub fn getNativeHandle(this: *SocketContext, comptime ssl: bool) *anyopaque {
return us_socket_context_get_native_handle(comptime @as(i32, @intFromBool(ssl)), this).?;
return us_socket_context_get_native_handle(@intFromBool(ssl), this).?;
}
fn _deinit_ssl(this: *SocketContext) void {
@@ -1143,10 +1143,7 @@ pub const SocketContext = opaque {
}
fn getLoop(this: *SocketContext, ssl: bool) ?*Loop {
if (ssl) {
return us_socket_context_loop(@as(i32, 1), this);
}
return us_socket_context_loop(@as(i32, 0), this);
return us_socket_context_loop(@intFromBool(ssl), this);
}
/// closes and deinit the SocketContexts
@@ -1164,7 +1161,7 @@ pub const SocketContext = opaque {
pub fn close(this: *SocketContext, ssl: bool) void {
debug("us_socket_context_close({d})", .{@intFromPtr(this)});
us_socket_context_close(@as(i32, @intFromBool(ssl)), this);
us_socket_context_close(@intFromBool(ssl), this);
}
pub fn ext(this: *SocketContext, ssl: bool, comptime ContextType: type) ?*ContextType {