diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-17 13:36:38 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-17 13:36:38 +0200 |
commit | 84a7c65b62e5ff322a23b91c2e80d517d41ed504 (patch) | |
tree | ae635f3d9a7f9fa0d6b07bdf168a0a7a9b707827 /src/io | |
parent | ba2d0b1d8dae67b6f8d3e815a61d26c7c0b1ce2f (diff) | |
download | chawan-84a7c65b62e5ff322a23b91c2e80d517d41ed504.tar.gz |
response: add blob() function
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/serialize.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/io/serialize.nim b/src/io/serialize.nim index bb65d157..6994b042 100644 --- a/src/io/serialize.nim +++ b/src/io/serialize.nim @@ -317,8 +317,9 @@ proc sread*(stream: Stream, blob: var Blob) = new(blob) stream.sread(blob.ctype) stream.sread(blob.size) - blob.buffer = alloc(blob.size) - blob.deallocFun = dealloc + let buffer = alloc(blob.size) + blob.buffer = buffer + blob.deallocFun = proc() = dealloc(buffer) if blob.size > 0: let n = stream.readData(blob.buffer, int(blob.size)) assert n == int(blob.size) |