dedup

deduplicating backup program
git clone git://git.2f30.org/dedup
Log | Files | Refs | README | LICENSE

commit 1f27546ac6b0a4fd6f0c5198afa34d5220e57107
parent 528b7c40c8b3dbcbce387f35f6de93e21f2860e0
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:
Mchunker.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

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;