fix: std.http dealloc_bytes calls match the Allocator protocol arity
The protocol declares dealloc_bytes(ptr) — the size argument I passed at three sites was silently accepted and dropped by the compiler (issue 0131); these calls would stop compiling the moment that diagnostic gap is fixed.
This commit is contained in:
@@ -220,7 +220,7 @@ Server :: struct {
|
||||
socket.close(c.fd);
|
||||
}
|
||||
if c.out_buf != null {
|
||||
self.own_alloc.dealloc_bytes(xx c.out_buf, c.out_len);
|
||||
self.own_alloc.dealloc_bytes(xx c.out_buf);
|
||||
c.out_buf = null;
|
||||
}
|
||||
// read_buf stays allocated — reused by the next connection here.
|
||||
@@ -332,7 +332,7 @@ Server :: struct {
|
||||
if want <= c.read_cap { return false; } // already at the limit
|
||||
nb : [*]u8 = xx self.own_alloc.alloc_bytes(want);
|
||||
if c.read_len > 0 { memcpy(nb, c.read_buf, xx c.read_len); }
|
||||
self.own_alloc.dealloc_bytes(xx c.read_buf, c.read_cap);
|
||||
self.own_alloc.dealloc_bytes(xx c.read_buf);
|
||||
c.read_buf = nb;
|
||||
c.read_cap = want;
|
||||
return true;
|
||||
@@ -516,7 +516,7 @@ Server :: struct {
|
||||
self.loop.del_write(c.fd);
|
||||
c.write_armed = false;
|
||||
}
|
||||
self.own_alloc.dealloc_bytes(xx c.out_buf, c.out_len);
|
||||
self.own_alloc.dealloc_bytes(xx c.out_buf);
|
||||
c.out_buf = null;
|
||||
c.out_len = 0;
|
||||
c.out_sent = 0;
|
||||
|
||||
Reference in New Issue
Block a user