diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-07-04 07:35:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-07-04 07:35:13 -0700 |
commit | 16fc52655f46dc27504c91d00eb788c64af1ef8c (patch) | |
tree | 28dc8d43547adaea49ba681001c8582dc173bb50 | |
parent | fd7d0c20dffdb06be271ea91d7e2b89ddd929863 (diff) | |
download | txr-16fc52655f46dc27504c91d00eb788c64af1ef8c.tar.gz txr-16fc52655f46dc27504c91d00eb788c64af1ef8c.tar.bz2 txr-16fc52655f46dc27504c91d00eb788c64af1ef8c.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.
-rw-r--r-- | chksum.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); } |