hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 9822a1375211e0931cd7b53de1d31d670163aeab
parent 1633326de981da42f4c2952cb9dcae297dfdcbca
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri,  9 Apr 2021 12:38:14 -0400

bufio::fixed: add closer

Diffstat:
Mbufio/fixed.ha | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/bufio/fixed.ha b/bufio/fixed.ha @@ -14,6 +14,7 @@ export fn fixed(in: []u8, mode: io::mode) *io::stream = { let s = alloc(fixed_stream { stream = io::stream { name = "<bufio::fixed>", + closer = &fixed_close, ... }, buf = in, @@ -51,6 +52,8 @@ fn fixed_write(s: *io::stream, buf: const []u8) (size | io::error) = { return n; }; +fn fixed_close(s: *io::stream) void = free(s); + @test fn fixed() void = { // TODO: add a read test too static let buf: [1024]u8 = [0...];