-/* We could try many techniques to match the final block. We can
- * simply try to checksum whatever's left at the end and see if it
- * matches the final block checksum. This works for the exact-match
- * case.
- *
- * We can do slightly better than this: if we try to match the checksum
- * on every block (starting with block_size 1) from where we end to EOF,
- * we can capture the "data appended" case as well.
- */
-static size_t final_block_match(struct crc_context *ctx)
-{
- size_t size;
- uint32_t crc;
-
- if (ctx->num_crcs == 0)
- return 0;
-
- crc = 0;
- for (size = 0; size < buffer_size(ctx); size++) {
- const uint8_t *p = ctx->buffer;
- crc = crc_add_byte(crc, p[ctx->buffer_start+size]);
- if ((crc & ctx->crcmask) == ctx->crc[ctx->num_crcs-1])
- return size+1;
- }
- return 0;
-}
-