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.
master
Alexander Iljin 2020-07-29 18:33:25 +02:00 committed by John Benediktsson
parent fbeb409979
commit 27d38225f4
1 changed files with 5 additions and 3 deletions

View File

@ -23,16 +23,18 @@ M: checksum checksum-lines
: checksum-file ( path checksum -- value ) : checksum-file ( path checksum -- value )
[ binary <file-reader> ] dip checksum-stream ; [ binary <file-reader> ] 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 M: checksum-state clone
call-next-method call-next-method
[ clone ] change-bytes ; [ clone ] change-bytes ;
: new-checksum-state ( class -- checksum-state ) : new-checksum-state ( class -- checksum-state )
new BV{ } clone >>bytes ; new-disposable BV{ } clone >>bytes ;
GENERIC: initialize-checksum-state ( checksum -- checksum-state ) GENERIC: initialize-checksum-state ( checksum -- checksum-state )
GENERIC#: add-checksum-bytes 1 ( checksum-state data -- checksum-state ) GENERIC#: add-checksum-bytes 1 ( checksum-state data -- checksum-state )