If there's no more input to consume return a null chunk - dedup - deduplicating backup program HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 1f27546ac6b0a4fd6f0c5198afa34d5220e57107 DIR parent 528b7c40c8b3dbcbce387f35f6de93e21f2860e0 HTML Author: sin <sin@2f30.org> Date: Thu, 21 Feb 2019 14:22:25 +0000 If there's no more input to consume return a null chunk Diffstat: M chunker.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- DIR diff --git a/chunker.c b/chunker.c @@ -1,4 +1,3 @@ -#include <assert.h> #include <err.h> #include <stdint.h> #include <stdio.h> @@ -95,7 +94,11 @@ get_chunk(struct chunker *chunker, size_t *chunk_size) { uint8_t *bp; - assert(chunker->rpos <= chunker->wpos); + if (chunker->rpos == chunker->wpos) { + *chunk_size = 0; + return NULL; + } + bp = &chunker->buf[chunker->rpos]; *chunk_size = get_chunk_size(chunker); chunker->rpos += *chunk_size;