Compare commits

...

2 Commits

Author SHA1 Message Date
Meghan Denny
76367e681e Merge branch 'main' into nektro-patch-21189 2025-02-14 20:41:32 -08:00
Meghan Denny
8305e60bf2 remove dubious @intFromPtr calls 2025-02-12 15:35:07 -08:00
2 changed files with 2 additions and 16 deletions

View File

@@ -3194,7 +3194,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp
const streamLog = Output.scoped(.ReadableStream, false);
pub fn didUpgradeWebSocket(this: *RequestContext) bool {
return @intFromPtr(this.upgrade_context) == std.math.maxInt(usize);
return this.upgrade_context == null;
}
fn toAsyncWithoutAbortHandler(ctx: *RequestContext, req: *uws.Request, request_object: *Request) void {
@@ -6400,7 +6400,7 @@ pub fn NewServer(comptime NamespaceType: type, comptime ssl_enabled_: bool, comp
return JSC.jsBoolean(false);
}
if (upgrader.upgrade_context == null or @intFromPtr(upgrader.upgrade_context) == std.math.maxInt(usize)) {
if (upgrader.upgrade_context == null) {
return JSC.jsBoolean(false);
}

View File

@@ -1793,26 +1793,13 @@ pub const fs_t = extern struct {
const UV_FS_CLEANEDUP = 0x0010;
pub inline fn deinit(this: *fs_t) void {
this.assertInitialized();
uv_fs_req_cleanup(this);
this.assertCleanedUp();
}
// This assertion tripping is a sign that .deinit() is going to cause invalid memory access
pub inline fn assertInitialized(this: *const fs_t) void {
if (bun.Environment.allow_assert) {
if (@intFromPtr(this.loop) == 0xAAAAAAAAAAAA0000) {
@panic("uv_fs_t was not initialized");
}
}
}
// This assertion tripping is a sign that a memory leak may happen
pub inline fn assertCleanedUp(this: *const fs_t) void {
if (bun.Environment.allow_assert) {
if (@intFromPtr(this.loop) == 0xAAAAAAAAAAAA0000) {
return;
}
if ((this.flags & UV_FS_CLEANEDUP) != 0) {
return;
}
@@ -1821,7 +1808,6 @@ pub const fs_t = extern struct {
}
pub inline fn ptrAs(this: *fs_t, comptime T: type) T {
this.assertInitialized();
return @ptrCast(this.ptr);
}