summaryrefslogtreecommitdiffstats
path: root/chksum.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-07-04 07:35:13 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-07-04 07:35:13 -0700
commite8472375ec4db62befaf87b1e85506234001e530 (patch)
tree28dc8d43547adaea49ba681001c8582dc173bb50 /chksum.c
parentc7b508747347e8a17546140da64e5170b01e075e (diff)
downloadtxr-e8472375ec4db62befaf87b1e85506234001e530.tar.gz
txr-e8472375ec4db62befaf87b1e85506234001e530.tar.bz2
txr-e8472375ec4db62befaf87b1e85506234001e530.zip
crc32-stream: recycle I/O buffer.
* chksum.c (crc32_stream): use iobuf_get to obtain the I/O buffer, and iobuf_put to recycle it.
Diffstat (limited to 'chksum.c')
-rw-r--r--chksum.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/chksum.c b/chksum.c
index 0400593b..4c7c7f2e 100644
--- a/chksum.c
+++ b/chksum.c
@@ -165,8 +165,8 @@ val sha256(val obj, val buf_in)
val crc32_stream(val stream, val nbytes)
{
u32_t crc = 0;
- val bfsz = num_fast(BUFSIZ);
- val buf = make_buf(bfsz, nil, nil);
+ val buf = iobuf_get();
+ val bfsz = length_buf(buf);
if (null_or_missing_p(nbytes)) {
for (;;) {
@@ -200,6 +200,7 @@ val crc32_stream(val stream, val nbytes)
}
}
+ iobuf_put(buf);
return unum(crc);
}