#include "serialise.hh" #include "util.hh" #include #include namespace nix { BufferedSink::~BufferedSink() { /* We can't call flush() here, because C++ for some insane reason doesn't allow you to call virtual methods from a destructor. */ assert(!bufPos); delete[] buffer; } void BufferedSink::operator () (const unsigned char * data, size_t len) { if (!buffer) buffer = new unsigned char[bufSize]; while (len) { /* Optimisation: bypass the buffer if the data exceeds the buffer size. */ if (bufPos + len >= bufSize) { flush(); write(data, len); break; } /* Otherwise, copy the bytes to the buffer. Flush the buffer when it's full. */ size_t n = bufPos + len > bufSize ? bufSize - bufPos : len; memcpy(buffer + bufPos, data, n); data += n; bufPos += n; len -= n; if (bufPos == bufSize) flush(); } } void BufferedSink::flush() { if (bufPos == 0) return; size_t n = bufPo
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul A. Patience <paul@apatience.com>2023-12-30 01:58:24 +0000
committerGuillaume Le Vaillant <glv@posteo.net>2024-01-04 15:11:47 +0100
commit3f5023a503a4cc232ced2097efe1ca3a57e80fe9 (patch)
treee4a48837e1c38779eff2b837436c8e75ba74dc85 /gnu/packages/nettle.scm
parent7d05e6c89e0de9853aa68dce6e21ea6451d40946 (diff)
downloadguix-3f5023a503a4cc232ced2097efe1ca3a57e80fe9.tar.gz
guix-3f5023a503a4cc232ced2097efe1ca3a57e80fe9.zip
gnu: cl-nibbles: Update to 0.14-3.a46a677.
* gnu/packages/lisp-xyz.scm (sbcl-nibbles): Update to 0.14-3.a46a677. [file-name]: Rename to cl-nibbles. Move above sha256. Change-Id: I6a95f3f24b043d7e2c192840d9bad62f5c661fb2 Signed-off-by: Guillaume Le Vaillant <glv@posteo.net>
Diffstat (limited to 'gnu/packages/nettle.scm')
0 files changed, 0 insertions, 0 deletions
en); } }