From 27d38225f4c69efe43e4976ea394c30caf01d023 Mon Sep 17 00:00:00 2001 From: Alexander Iljin Date: Wed, 29 Jul 2020 18:33:25 +0200 Subject: [PATCH] checksums: inherit checksum-state from disposable This allows the inherited tuples, including block-checksum-state, to be treated like the normal disposable tuples, instead of imitating only part of the interface. --- core/checksums/checksums.factor | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/checksums/checksums.factor b/core/checksums/checksums.factor index c5fc5f7058..4503ee05ff 100644 --- a/core/checksums/checksums.factor +++ b/core/checksums/checksums.factor @@ -23,16 +23,18 @@ M: checksum checksum-lines : checksum-file ( path checksum -- value ) [ binary ] dip checksum-stream ; -TUPLE: checksum-state checksum { bytes byte-vector } ; +TUPLE: checksum-state < disposable + checksum + { bytes byte-vector } ; -M: checksum-state dispose drop ; +M: checksum-state dispose* drop ; M: checksum-state clone call-next-method [ clone ] change-bytes ; : new-checksum-state ( class -- checksum-state ) - new BV{ } clone >>bytes ; + new-disposable BV{ } clone >>bytes ; GENERIC: initialize-checksum-state ( checksum -- checksum-state ) GENERIC#: add-checksum-bytes 1 ( checksum-state data -- checksum-state )